we are looking to set up Keycloak using Liquibase to define its database schema. Our goal is to prevent Keycloak from directly executing any SQL commands during its startup process. Instead, we only want it to generate all the SQL commands needed for its initialization. This way, we can run these SQL commands manually before starting Keycloak to ensure that the database is properly prepared.
We are using Keycloak 22.0.1 and we've found that before Keycloak 15 you would simply paste the following command inside standalone.xml or standalone-ha.xml, but now they aren't available anymore.
hibernate.hbm2ddl.export = true
Now we have tried the following:
KEYCLOAK_HIBERNATE_HBM2DDL_EXPORT=true
--spi-connections-jpa-legacy-migration-strategy=manual --spi-connections-jpa-legacy-initialize-empty=false --spi-connections-jpa-legacy-migration-export=<path>/exportKC_DB.sql
But none did the work.
Do you have any suggestion? Thanks
I resolved it using the parameters after kc.sh start
:
--spi-connections-jpa-legacy-migration-strategy=manual --spi-connections-jpa-legacy-initialize-empty=false --spi-connections-jpa-legacy-migration-export=<path>/exportKC_DB.sql
but the important thing is that it already has to be configured with the proper DB, using these parameters while using H2 won't work.