From 4c39dd4c9ba21e8a36b8aa0a5ea4422be667abbd Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Mon, 22 Aug 2016 10:29:25 +0200 Subject: [PATCH] Update topics/database/hibernate.adoc --- topics/database/hibernate.adoc | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) mode change 100755 => 100644 topics/database/hibernate.adoc diff --git a/topics/database/hibernate.adoc b/topics/database/hibernate.adoc old mode 100755 new mode 100644 index 8eab6850ee..7b8805d510 --- a/topics/database/hibernate.adoc +++ b/topics/database/hibernate.adoc @@ -1,18 +1,17 @@ -=== Hibernate Configuration +=== Database Configuration -The Hibernate persistence API is already pre-configured out of the box and rarely needs to be changed. -The configuration for this component lies in the _keycloak-server.json_ file. If you are running -in standalone mode, this file is in the _.../standalone/configuration_ directory. If you are running in domain mode -this file will live in the _.../domain/servers/{server name}/configuration_ directory. +The configuration for this component lies in the _keycloak-server.json_ file. If you are running in standalone mode, this file is in the _.../standalone/configuration_ directory. If you are running in domain mode this file will live in the _.../domain/servers/{server name}/configuration_ directory. -.Hibernate JPA Config +.Database Config [source,json] ---- "connectionsJpa": { "default": { "dataSource": "java:jboss/datasources/KeycloakDS", - "databaseSchema": "update" + "initializeEmpty": false, + "migrationStrategy": "manual", + "migrationExport": "${jboss.home.dir}/keycloak-database-update.sql" } }, ---- @@ -29,6 +28,15 @@ driverDialect:: Value of database dialect. In most cases you don't need to specify this property as dialect will be autodetected by Hibernate. +initializeEmpty:: + Initialize database if empty. If set to false the database has to be manually initialized. If you want to manually initialize the database set migrationStrategy to `manual` which will create a file with SQL commands to initialize the database. Defaults to true. + +migrationStrategy:: + Strategy to use to migrate database. Valid values are `update`, `manual` and `validate`. Update will automatically migrate the database schema. Manual will export the required changes to a file with SQL commands that you can manually execute on the database. Validate will simply check if the database is up-to-date. + +migrationExport:: + Path for where to write manual database initialization/migration file. + databaseSchema:: Specify if schema should be updated or validated. Valid values are `update` (default) and `validate`. The `update` value will set up or update