Migrate to latest available revision #949
-
Hello everyone, within my deployment pipeline, I want to make sure that the database is on the same revision as the latest available migration script. If one is always go forward, this is quite easy by running The cookbook and this stackoverflow answer gives me an idea about how to get the latest revision number in the migration files and trigger update/downgrade. As this seems to me like a quite common task, I wonder if there is already a complete solution out there (I couldn't find any until now)? fin swimmer |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Stupid me 🤦♂️ If the latest available migration script means a downgrade, there are of course no instructions about how to migrate. So rolling back needs some more advanced logic at all. |
Beta Was this translation helpful? Give feedback.
-
I think you need to downgrade the DB given the newer version of the code first, so the downgrade scripts are there, then check out the older version of the code. in practice, for development databases people likely just rebuild dev databases from zero. upgrades are much easier to deal with than downgrades. |
Beta Was this translation helpful? Give feedback.
I think you need to downgrade the DB given the newer version of the code first, so the downgrade scripts are there, then check out the older version of the code.
in practice, for development databases people likely just rebuild dev databases from zero. upgrades are much easier to deal with than downgrades.