I’ve been running Ghost on a Heroku server for the past few months. It’s based on the Ghost on Heroku projecet. Today I tried upgrading the Ghost library from 2.9.1 to 2.14.1 and since I did I’ve been receiving the following error:
Unhandled rejection MigrationsAreLockedError: Migration lock was never released or currently a migration is running.
Reverting didn’t help and now I can’t modify my database become of this. Is there anything I can do?
This only appears if the migration process was destroyed while the migrator migrates your database. The lock was never released because the process was destroyed. Locking the database is important and protects multiple processes trying to migrate your database.
Did you run ghost update --rollback already? It should force a rollback from the CLI.
I tried running that command but it didn’t detect any Ghost installs. I think this is because my project uses the npm module for Ghost. The error says I can release the lock by running an Update SQL query but there are no entries in the migration_lock table of my database.
You can manually unlock the database. But be aware that you are responsible for manual actions like that. You should double check the health of your database before running this command.
UPDATE migrations_lock set locked=0 where lock_key='km01';