Skip to content

Can't upgrade 6.26 to 6.27 or later because of a migration foreign key fail #27652

Closed

Description

@Lelenaic

Issue Summary

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

Activity

  1. added
    needs:triage
    on May 2, 2026
  2. 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
  3. sagzy commented on May 4, 2026

    @sagzy
    Contributor

    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-8

    Let us know if you're still stuck after following these steps. I'm closing this issue for now.

  4. removed
    needs:triage
    on May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions