Migration
- Rails runs each migration inside a transaction.
- If the migration fails, the transaction is rolled back.
#
Example: time taken removing the index:User table has 1 Million rows:
It was pretty fast. 3 Milliseconds for 1 million rows.
Migration
- Output on console
#
Example: time taken adding the index:User table has 1 million rows:
It's slow. 13 seconds for 1 million rows.
Imagine what happens when you have 10/100 Million rows?
This will lock that table for that long.
Migration
- Output on console
#
Problem ?warning
It will basically cause a downtime for 13 seconds
#
Solution- Check: Table lock during migration.