Downgrading Keycloak

We recently upgraded our Keycloak from version 11 to 14, but want to rollback due to some issues.

Keycloak crashes if we try to downgrade it to version 11. This seems to be an issue in the DB and we see this in the logs:

09:23:23,007 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (ServerService Thread Pool – 67) Table ‘keycloakREALM_DEFAULT_ROLES’ doesn’t exist
09:23:23,012 FATAL [org.keycloak.services] (ServerService Thread Pool – 67) Error during startup: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:63)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)

Did you rollback migrations that happened with migrating to version 14? Probably some DB change is causing this now.

Yes that’s a database incompatibility.

I recommend to always create a backup before running a Keycloak upgrade. Also testing the effects of upgrading / downgrading with each new Keycloak version in a comparable environment is useful to learn about potential downtime.