06bc4af50e
* Remove WildFly distribution from documentation Closes #1665 * Update server_admin/topics/authentication/webauthn.adoc Co-authored-by: Pedro Igor <pigor.craveiro@gmail.com> * Update upgrading/topics/install_new_version.adoc Co-authored-by: Pedro Igor <pigor.craveiro@gmail.com> * Update upgrading/topics/migrate_db.adoc Co-authored-by: Pedro Igor <pigor.craveiro@gmail.com> * Update upgrading/topics/migrate_db.adoc Co-authored-by: Pedro Igor <pigor.craveiro@gmail.com> * Update server_admin/topics/realms/ssl.adoc * Update server_admin/topics/user-federation/ldap.adoc Co-authored-by: Pedro Igor <pigor.craveiro@gmail.com> * Update server_development/topics/providers.adoc Co-authored-by: Pedro Igor <pigor.craveiro@gmail.com> * Update server_development/topics/providers.adoc Co-authored-by: Pedro Igor <pigor.craveiro@gmail.com> * Remove section on cilent cert lookup in x509.adoc * Update securing_apps/topics/oidc/fapi-support.adoc Co-authored-by: Pedro Igor <pigor.craveiro@gmail.com> * Add missing images for rh-sso images by moving to shared images as we won't have RH-SSO specific theme anymore Co-authored-by: Pedro Igor <pigor.craveiro@gmail.com>
49 lines
2.1 KiB
Text
49 lines
2.1 KiB
Text
[[_migrate_db]]
|
|
|
|
== Database migration
|
|
|
|
{project_name} can automatically migrate the database schema, or you can choose to do it manually. By default the
|
|
database is automatically migrated when you start the new installation for the first time.
|
|
|
|
=== Automatic relational database migration
|
|
|
|
To enable automatic upgrading of the database schema, set the migration-strategy property value to "update" for the
|
|
default connections-jpa provider:
|
|
|
|
[source,bash]
|
|
----
|
|
kc.[sh|bat] start --spi-connections-jpa-legacy-migration-strategy=update
|
|
----
|
|
|
|
When you start the server with this setting your database is automatically migrated if the database schema has changed
|
|
in the new version.
|
|
|
|
Creating an index on huge tables with millions of records can easily take a huge amount of time
|
|
and potentially cause major service disruption on upgrades.
|
|
For those cases, we added a threshold (the number of records) for automated index creation.
|
|
By default, this threshold is `300000` records.
|
|
When the number of records is higher than the threshold, the index is not created automatically,
|
|
and there will be a warning message in server logs including SQL commands which can be applied later manually.
|
|
|
|
To change the threshold, set the `index-creation-threshold` property, value for the default `connections-liquibase` provider:
|
|
|
|
[source,bash]
|
|
----
|
|
kc.[sh|bat] start --spi-connections-liquibase-default-index-creation-threshold=300000
|
|
----
|
|
|
|
=== Manual relational database migration
|
|
|
|
To enable manual upgrading of the database schema, set the migration-strategy property value to "manual" for the default
|
|
connections-jpa provider:
|
|
|
|
[source,bash]
|
|
----
|
|
kc.[sh|bat] start --spi-connections-jpa-legacy-migration-strategy=manual
|
|
----
|
|
|
|
When you start the server with this configuration it checks if the database needs to be migrated. The required changes
|
|
are written to an SQL file that you can review and manually run against the database. For further details on how to
|
|
apply this file to the database, see the documentation for the relational database you're using. After the changes have
|
|
been written to the file, the server exits.
|
|
|