We have two metabase instances on Azure with Postgresql databases - let's call them one and two.
A few months ago we tried (and failed) to upgrade instance one. At the time we didn't make a backup of the database (big mistake). We were able to get it back online after downgrading the version back to 0.42.4, with some ad-hoc changes to the database.
We let it be for a while but now would like to upgrade instance one to the latest version. As you can probably guess, now we can't upgrade due to the database state being 'corrupted'. So, we would like to try to restore the database to a healthy state and/or recover the data.
We were able to upgrade instance two from v0.42.4 to the latest version. It works perfectly.
Since we have this database, we are able to use some external tools to find the diff in the database schemas and generate a script to make the schemas equal. Obviously this script has quite some flaws and will need to be reworked to fit.
I am wondering if anyone has had a similar situation and what the approach was or if they have any suggestions. Would it perhaps be easier to create a new database and manually migrate the data where possible?
Thanks in advance!
Adding a reply because I forgot to add some context:
I have tried to run metabase with the latest version and the
migrate down command, as well as v0.42.4 with
migrate down and
It seems to not work, as the logs from the container go like this and then it exits back into the bash shell.
2024-01-29 09:56:45 2024-01-29 09:56:45,327 INFO db.setup :: Setting up Liquibase...
2024-01-29 09:56:46 2024-01-29 09:56:46,067 INFO db.setup :: Liquibase is ready.
2024-01-29 09:56:46 2024-01-29 09:56:46,068 INFO db.liquibase :: Checking if Database has unrun migrations...
2024-01-29 09:56:48 2024-01-29 09:56:48,989 INFO db.liquibase :: Database has unrun migrations. Waiting for migration lock to be cleared...
2024-01-29 09:56:49 2024-01-29 09:56:49,150 INFO db.liquibase :: Migration lock is cleared. Running migrations...
After a few attempts which seemed to stop mid-way, I was able to then
migrate up successfully on a metabase:latest image.
Curiously, there are still more tables in this database than the one which was 'naturally' upgraded from 0.42.4 to latest. Not sure if the migration tool does not delete certain tables or something, but everything seems to be working so I'm not too concerned.