I've got this error during app schema migration

{"timestamp":"2023-01-11 11:53:09.043 Z","level":"fatal","msg":"Failed to apply database migrations.","caller":"sqlstore/store.go:169","error":"driver: mysql, message: failed when applying migration, command: apply_migration, originalError: Error 1845: LOCK=NONE is not supported for this operation. Try LOCK=SHARED., query: \n\nSET @preparedStatement = (SELECT IF(\n    (\n        SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS\n        WHERE table_name = 'Posts'\n        AND table_schema = DATABASE()\n        AND index_name = 'idx_posts_create_at_id'\n    ) > 0,\n    'SELECT 1;',\n    'CREATE INDEX idx_posts_create_at_id on Posts(CreateAt, Id) LOCK=NONE;'\n));\n\nPREPARE createIndexIfNotExists FROM @preparedStatement;\nEXECUTE createIndexIfNotExists;\nDEALLOCATE PREPARE createIndexIfNotExists;\n\n"}

Any options do I have to apply new schema and use app as usual?


1 Answer 1


I solved an issue by removing LOCK=NONE from the DB query that contains it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.