Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manually marking flyway migration as completed

Couple of days ago we made a mistake. We have a kubernetes cluster with a pipeline that times out in 25 minutes, meaning if the deployment wasn't done in 25 minutes, it will fail. We deployed a flyway migration that involves some queries that run for more than an hour. Stupid, I know. now we ran the queries in the migration manually, We want to manually mark the flyway migration as done, otherwise redeployment won't work. Is there a way this could be done?

like image 446
Niro Avatar asked Nov 07 '22 00:11

Niro


1 Answers

So we ended up manually inserting a migration row in the database. flyway keeps a table flyway_schema_history in your schema. If you manually insert a row there it will skip the migration. The only tricky part is calculating the checksum. You can either migrate locally, get the checksum and inject it the live database, or just re-calculate the checksum on your own.

You will find how they calculate the checksum in the AbstractLoadableResource class.

like image 100
Niro Avatar answered Nov 14 '22 22:11

Niro