Complete the code to define a new table in schema.rb.
create_table :users do |[1]|
t.string :name
endThe block variable is usually t to define columns inside create_table.
Complete the code to add a datetime column for tracking record creation.
t.[1] :created_atIn Rails schema.rb, datetime is used for date and time columns like created_at.
Fix the error in the schema.rb code to add a string column with a limit of 50 characters.
t.string :username, [1]: 50
The correct option to limit string length in schema.rb is limit.
Fill both blanks to add an index on the email column and make it unique.
add_index :users, :email, [1]: true, [2]: 'index_users_on_email'
To add a unique index, use unique: true. The index name is set with name:.
Fill all three blanks to create a table without the default id column, with a text column, and timestamps.
create_table :posts, id: [1] do |[2]| [2].text :content [2].timestamps end
Setting id: false disables default id. The block variable is t used to define columns and timestamps.