Migration Lock after updating ghost image

Hi, I’m currently running a ghost blog on a synology NAS system using mysql and a ghost docker image.

I recently updated the ghost image, and did a migration, but it stopped working and got migration database locked.

Currently, files such as posts and database are all stored on the server, but when I try to access the CLI of the ghost image, it crashes and is unavailable because the container is terminated.

Before asking the question, I checked the internet and confirmed that there are two ways to remove the migration_lock table: Ghost CLI is not accessible for the same reason as above, and it is also not possible to access mysql to remove the migration_lock table.

Is there any other way to solve migration lock problem?

This is my ghost container’s error log:

	    at async bootGhost (/var/lib/ghost/versions/5.89.0/core/boot.js:537:9)e[39m
2024/08/12 20:41:58	stdout	    at async initDatabase (/var/lib/ghost/versions/5.89.0/core/boot.js:69:5)
2024/08/12 20:41:58	stdout	    at async DatabaseStateManager.makeReady (/var/lib/ghost/versions/5.89.0/core/server/data/db/DatabaseStateManager.js:73:25)
2024/08/12 20:41:58	stdout	    at async DatabaseStateManager.getState (/var/lib/ghost/versions/5.89.0/core/server/data/db/DatabaseStateManager.js:40:13)
2024/08/12 20:41:58	stdout	    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024/08/12 20:41:58	stdout	    at /var/lib/ghost/versions/5.89.0/node_modules/knex-migrator/lib/locking.js:62:23
2024/08/12 20:41:58	stdout	e[90mMigrationsAreLockedError: Migration lock was never released or currently a migration is running.
2024/08/12 20:41:58	stdout	
2024/08/12 20:41:58	stdout	e[90m----------------------------------------e[39m

Thanks for support :face_with_head_bandage:

You need to log into MySQL or connect with MySQL with database management tool and unlock the migrations_lock table:

Unlock the table: UPDATE migrations_lock set locked = 0 where lock_key = 'km01';

Thanks for reply,

I accessed the mysql container and updated the migration_lock table but got the same MigrationsAreLockedError, so when I checked the table, it was an empty table with no value for the key ‘km01’…

Then try to insert it:
INSERT INTO migrations_lock (lock_key, locked, acquired_at, released_at) VALUES ('km01', 0, '2024-05-21 00:16:28', '2024-05-21 00:16:40');

1 Like

It works like charm, really thanks for your help! :face_holding_back_tears: