migrate
migrate copied to clipboard
Support for adding applied migration in schema_migrations table
Due to multiple team members working with the same application we need to track what all migration have been applied in their local system compared to production. Currently schema_migrations table contains the record of the latest applied migration but that is not helpful for rollback because their is no information regarding how many steps rollback is needed before the incoming migrations can be applied.
This issue has been mentioned #510 here but there is no update if this feature will be supported in future. Ideally it should be like sql-migrate which stores previously run migrations.
This is a very serious problem for migrate. It represents a massive foot gun.
Scenario: Two devs are working on branches and they both add migrations. The branch with a migration with a later timestamp merges and deploy's first. The branch with the earlier timestamped migration merges and deploy's
Result: The earlier timestamped migration does not run at all, and migrate does not complain about it at all.
duplicate https://github.com/golang-migrate/migrate/issues/179
I described a workaround that has been quite successful at catching "invalid" migration timestamps on my team as we have grown https://github.com/golang-migrate/migrate/issues/179#issuecomment-947094417
What happens when you run the down command? If I have 20 migration pairs (up/down) for a project that has been going for a while now, creating tables, modifying column types, adding columns, etc, if I run the down command its going to run all down migrations for all 20 files?