Skip to content

import does not seem to run db migration #43793

@Hartorn

Description

@Hartorn

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

import-export

Describe the bug

We are using keycloak container, and what we do is to always run import to initalise master realm with some settings.

opt/keycloak/bin/kc.sh import --override=false

Then we do start using the start command

With latest version, we encountered this :

2025-10-28 18:29:10,327 INFO  [org.keycloak.url.HostnameV2ProviderFactory] (main) If hostname is specified, hostname-strict is effectively ignored
2025-10-28 18:29:35,018 INFO  [org.hibernate.orm.jdbc.batch] (JPA Startup Thread) HHH100501: Automatic JDBC statement batching enabled (maximum batch size 32)
2025-10-28 18:29:46,299 INFO  [com.arjuna.ats.jbossatx] (main) ARJUNA032014: Stopping transaction recovery manager
2025-10-28 18:29:46,620 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to start server in (nonserver) mode
2025-10-28 18:29:46,620 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Database not up-to-date, please enable database migration
2025-10-28 18:29:46,624 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) For more details run the same command passing the '--verbose' option. Also you can use '--help' to see the details about the usage of the particular command.

Version

26.4.2

Regression

  • The issue is a regression

Expected behavior

I would expect the import command to run database migration before doing the import.

Actual behavior

Database migration is not done when launching import, even with --spi-connections-jpa-quarkus-migration-strategy=update

How to Reproduce?

1- Setup keycloak on a previous version
2- Keep the database
3- Change the version and run import, before starting the server

Anything else?

I'm pretty sure this was working before, we are using keycloak since version 24.0.5, and I don't think we ever had any issues with db upgrade.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions