Complete the code to generate a new migration named AddAgeToUsers.
rails generate [1] AddAgeToUsersThe rails generate migration command creates a new migration file.
Complete the migration method to add an integer column named age to users table.
def change add_column :users, :age, [1] end
The add_column method needs the column type. Here, :integer is correct for age.
Fix the error in the migration to remove the age column from users table.
def change [1] :users, :age end
To remove a column, use remove_column method.
Fill both blanks to create a migration that adds a string column called email to users table.
def change [1] :users, :email, [2] end
Use add_column to add a column, and specify :string as the type for email.
Fill all three blanks to create a migration that renames the column username to login in users table.
def change [1] :users, [2], [3] end
Use rename_column with the old column name :username and the new name :login.