Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Upgrade to 26.5.0 failing due to FK_ORG_INVITATION_ORG constraint #45239

@nicolabeghin

Description

@nicolabeghin

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

organizations

Describe the bug

When upgrading Keycloak from 26.4.7 to 26.5.0 on DB MariaDB 10.11, the following Liquibase exception is thrown blocking the upgrade.

2026-01-08 00:00:58,950 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for changeset META-INF/jpa-changelog-26.5.0.xml::26.5.0-invitations-table::keycloak:
    Reason: liquibase.exception.DatabaseException: (conn=4) Can't create table `keycloak`.`ORG_INVITATION` (errno: 150 "Foreign key constraint is incorrectly formed") [Failed SQL: (1005) ALTER TABLE keycloak.ORG_INVITATION ADD CONSTRAINT FK_ORG_INVITATION_ORG FOREIGN KEY (ORGANIZATION_ID) REFERENCES keycloak.ORG (ID) ON DELETE CASCADE]

ref.

<addForeignKeyConstraint baseTableName="ORG_INVITATION"

Version

26.5.0

Regression

  • The issue is a regression

Expected behavior

Upgrade not failing

Actual behavior

Failing due to the above issue

How to Reproduce?

Upgrade a Keycloak instance from 26.4.7 to 26.5.0 with DB MariaDB 10.11

Anything else?

Issue comes from the fact that ORG table is not created with UTF8

Image Image

while ORG_INVITATION is

Image

If the field ORG.ID referenced by foreign key FK_ORG_INVITATION_ORG is fixed to be in UTF8 as all the others

ALTER TABLE `ORG` CHANGE `ID` `ID` VARCHAR(255)  CHARACTER SET utf8mb4  NOT NULL;

the constraint can be correctly created

ALTER TABLE keycloak.ORG_INVITATION ADD CONSTRAINT FK_ORG_INVITATION_ORG FOREIGN KEY (ORGANIZATION_ID) REFERENCES keycloak.ORG (ID) ON DELETE CASCADE

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions