Performance: Running and rolling back migrations
This concept affects the database schema update speed and application startup time during deployment.
rails db:migrate
rails db:migrate:reset
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Running all migrations every deploy | N/A | N/A | N/A | [X] Bad |
| Running only pending migrations | N/A | N/A | N/A | [OK] Good |
| Rolling back many migrations at once | N/A | N/A | N/A | [X] Bad |
| Rolling back one migration at a time | N/A | N/A | N/A | [OK] Good |
rails db:rollback.rails db:migrate:down requires specifying a version, rails db:reset resets the whole database, and rails db:rollback STEP=2 rolls back two steps, not one.rails db:migraterails db:migraterails db:rollback STEP=2rails db:migrate twice, then rollback with STEP=2 undoes both.rails db:rollback STEP=3 but get an error saying there are not enough migrations to rollback. What is the likely cause?rails db:rollback STEP=3 to undo the last three migrations at once.rails db:migrate three times to apply each migration individually.Pass the test and this pattern moves unknown