Performance: Why migrations version the database
This affects the speed and reliability of database schema updates during app deployment and runtime.
Using Rails migrations with version numbers to track applied changesManually running SQL scripts without tracking versions or timestamps| Pattern | Database Locks | Repeated Changes | Downtime Risk | Verdict |
|---|---|---|---|---|
| Manual SQL scripts without versioning | High - long locks possible | High - repeated runs | High - conflicts cause downtime | [X] Bad |
| Rails migrations with versioning | Low - short incremental locks | None - runs once per version | Low - orderly updates | [OK] Good |
20240612123456_create_users.rb -> Option C20240601010101_create_users.rb20240602020202_add_email_to_users.rbrails db:migrate again without new migrations?rails db:migrate?20240612120000_add_age_to_users.rb and Developer B creates 20240612120000_add_status_to_users.rb. What issue arises and how should it be resolved?Pass the test and this pattern moves unknown