0
0
Ruby on Railsframework~10 mins

Running and rolling back migrations in Ruby on Rails - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to run all pending migrations in Rails.

Ruby on Rails
rails db:[1]
Drag options to blanks, or click blank then click option'
Amigrate
Bseed
Crollback
Dconsole
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'rollback' instead of 'migrate' to apply migrations.
Confusing 'seed' with migration commands.
2fill in blank
medium

Complete the code to rollback the last migration in Rails.

Ruby on Rails
rails db:[1]
Drag options to blanks, or click blank then click option'
Asetup
Bmigrate
Creset
Drollback
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'migrate' which applies migrations instead of rolling back.
Using 'reset' which drops and recreates the database.
3fill in blank
hard

Fix the error in the command to rollback the last two migrations.

Ruby on Rails
rails db:rollback [1]2
Drag options to blanks, or click blank then click option'
A--times
B--number
CSTEP=
D--count
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--count' or '--number' which are not valid options.
Omitting the option and just writing a number.
4fill in blank
hard

Fill both blanks to create a command that resets the database and runs all migrations.

Ruby on Rails
rails db:[1] db:[2]
Drag options to blanks, or click blank then click option'
Adrop
Bmigrate
Creset
Dseed
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'drop' instead of 'reset' which does not run migrations automatically.
Using 'seed' which populates data but does not affect schema.
5fill in blank
hard

Fill all three blanks to rollback the last migration, reset the database, and then migrate again.

Ruby on Rails
rails db:[1] db:[2] db:[3]
Drag options to blanks, or click blank then click option'
Adrop
Bmigrate
Creset
Drollback
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'drop' instead of 'reset' which does not run migrations automatically.
Mixing the order of commands.