You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't upgrade 6.26 to 6.27 or later because of a migration foreign key fail #27652
Hi,
I've got an issue when trying to upgrade when I'm trying to upgrade my Ghost instance from 6.26 to 6.27 or later. A migration is failing. Please see the details below.
Steps to Reproduce
Upgrade from Ghost 6.26 to 6.27 or later
Ghost Version
6.26
Node.js Version
22.22.2
How did you install Ghost?
Official Ghost docker image
Database type
MySQL 8
Browser & OS version
No response
Relevant log / error output
Docker container logs:
ghost-1 | alter table `gifts` add constraint `gifts_buyer_member_id_foreign` foreign key (`buyer_member_id`) references `members` (`id`) on delete SET NULL - Referencing column 'buyer_member_id' and referenced column 'id'in foreign key constraint 'gifts_buyer_member_id_foreign' are incompatible.
ghost-1 |
ghost-1 | {"config":{"transaction":false},"name":"2026-04-06-07-48-06-add-gifts-table.js"}
ghost-1 |"Error occurred while executing the following migration: 2026-04-06-07-48-06-add-gifts-table.js"
ghost-1 |
ghost-1 | Error ID:
ghost-1 | 300
ghost-1 |
ghost-1 | Error Code:
ghost-1 | ER_FK_INCOMPATIBLE_COLUMNS
Code of Conduct
I agree to be friendly and polite to people in this repository
changed the title [-]SQL constraint failed upgrade 6.26 to 6.27 or later[/-][+]Can't upgrade 6.26 to 6.27 or later because of a migration foreign key fail[/+]on May 2, 2026
Hey @Lelenaic, thanks for the report. This looks like the same issue as #27263: a charset/collation mismatch between your existing tables and what the gifts migration is creating, which MySQL rejects when adding the foreign key.
Activity
[-]SQL constraint failed upgrade 6.26 to 6.27 or later[/-][+]Can't upgrade 6.26 to 6.27 or later because of a migration foreign key fail[/+]sagzy commentedon May 4, 2026
Hey @Lelenaic, thanks for the report. This looks like the same issue as #27263: a charset/collation mismatch between your existing tables and what the gifts migration is creating, which MySQL rejects when adding the foreign key.
The fix is to bring your database in line with Ghost's expected charset/collation (
utf8mb4/utf8mb4_0900_ai_ci). This official guide walks through it: https://docs.ghost.org/faq/supported-databases#how-to-update-mysql-5-to-mysql-8Let us know if you're still stuck after following these steps. I'm closing this issue for now.
fix(ghost): version-agnostic Dockerfile, unpin from 6.25.1
fix(ghost): version-agnostic Dockerfile, unpin from 6.25.1