|
|
|
|
|
by quilombodigital
1649 days ago
|
|
Through the years I have many times worked on this problem.
I´ve worked with rake tasks when using ruby, and many times in java, with flyway and my own system.
Database Migration is not a complicated problem, you just commit to the repository a sequence of SQL/code scripts to execute and keep at the database the current step.
The big misconception people have is that they can "rollback" when an issue arises.
The true fact is that when there is an issue, it happened because something not planned happened, and this can be spurious data in production, production environment differences, script errors, or whatever, and trying to rollback automatically in an undetermined state is just crazy.
That´s why migrations must be always FORWARD, no matter what. You try to mitigate all risks, the best you can, by running the migration in test databases (the perfect scenario is to perform a test in a production data clone, but this is not usually possible) and if anything wrong happens, deal with it, fix the database by hand, make code patches, and after it is solved, try to figure out why this slipped through your QA. |
|