Recall & Review
beginner
What command runs all pending migrations in Rails?
Use
rails db:migrate to run all migrations that have not yet been applied to the database.Click to reveal answer
beginner
How do you rollback the last migration in Rails?
Use
rails db:rollback to undo the last migration that was run.Click to reveal answer
beginner
What does
rails db:migrate:status show?It shows a list of all migrations and whether each one has been applied (up) or not (down).
Click to reveal answer
intermediate
How can you rollback multiple migrations at once?
Use
rails db:rollback STEP=n where n is the number of migrations to undo.Click to reveal answer
intermediate
What is the difference between
rails db:rollback and rails db:migrate:down VERSION=xxxx?rails db:rollback undoes the last migration by default, while rails db:migrate:down VERSION=xxxx rolls back a specific migration by its version number.Click to reveal answer
Which command runs all pending migrations in Rails?
✗ Incorrect
rails db:migrate runs all migrations that have not yet been applied.
How do you undo the last migration in Rails?
✗ Incorrect
rails db:rollback undoes the last migration.
What does
rails db:migrate:status display?✗ Incorrect
This command shows which migrations are up or down.
How to rollback the last 3 migrations?
✗ Incorrect
Use rails db:rollback STEP=3 to undo the last three migrations.
Which command rolls back a specific migration by version?
✗ Incorrect
rails db:migrate:down VERSION=xxxx rolls back a specific migration.
Explain how to run migrations and then undo the last migration in Rails.
Think about commands to apply changes and then reverse the last change.
You got /4 concepts.
Describe how to check migration status and rollback multiple migrations in Rails.
Consider commands that show migration states and undo several steps.
You got /4 concepts.