0
0
Ruby on Railsframework~5 mins

Creating migrations in Ruby on Rails - Quick Revision & Summary

Choose your learning style9 modes available
Recall & Review
beginner
What is a migration in Rails?
A migration is a way to change the database schema over time in a consistent and easy way. It helps create, modify, or drop tables and columns.
Click to reveal answer
beginner
How do you generate a new migration file in Rails?
Use the command rails generate migration MigrationName. This creates a new migration file with a timestamp.
Click to reveal answer
beginner
What method do you use inside a migration to create a new table?
Use the create_table method inside the change method to define a new table and its columns.
Click to reveal answer
intermediate
What does the change method do in a migration?
The change method defines the changes to apply to the database. Rails can automatically reverse these changes when rolling back.
Click to reveal answer
beginner
How do you run migrations to update the database schema?
Run rails db:migrate to apply all pending migrations and update the database schema.
Click to reveal answer
Which command creates a new migration file in Rails?
Arails migration create AddUserEmail
Brails generate migration AddUserEmail
Crails new migration AddUserEmail
Drails create migration AddUserEmail
What method inside a migration defines the database changes?
Achange
Bupdate
Cmodify
Dalter
How do you apply migrations to update the database?
Arails db:migrate
Brails db:reset
Crails db:rollback
Drails db:create
Which method creates a new table in a migration?
Amake_table
Badd_table
Cnew_table
Dcreate_table
What does Rails use to order migration files?
AAlphabetical order
BFile size
CTimestamp in filename
DRandom order
Explain how to create and run a migration to add a new column to an existing table in Rails.
Think about the command to create migration, the method to add a column, and how to apply it.
You got /3 concepts.
    Describe the purpose of the change method in Rails migrations and how it helps with rolling back changes.
    Focus on how change method works both forward and backward.
    You got /3 concepts.