rails db:migrate?rails db:migrate in your Rails project. What is the immediate effect on your database?Running rails db:migrate applies all pending migrations to update the database schema. Rails records which migrations have run in the schema_migrations table to avoid rerunning them.
rails db:rollback?rails db:migrate to apply three migrations, you run rails db:rollback. What is the state of the database schema?rails db:rollback reverses the last migration that was applied, updating the database schema accordingly. It does not undo all migrations at once.
The STEP option tells Rails how many migrations to rollback. rails db:rollback STEP=2 rolls back the last two migrations.
rails db:rollback fail with 'No migrations to rollback'?rails db:rollback but get the error 'No migrations to rollback'. What is the most likely reason?If no migrations have been applied, Rails cannot rollback anything and shows this error.
rails db:migrate:redo?rails db:migrate:redo. What does this command do to your database schema?rails db:migrate:redo rolls back the last migration and then runs it again. This is useful for testing or fixing the last migration.
