Treatment of Unicode characters varies among databases. This change
adds support for Unicode characters in the following fields:
* Realms: display name, HTML display name
* Users: username, given name, last name, attribute values
* Groups: name, attribute values
* Components: attribute values
* Roles: name
* Descriptions of objects
Unicode support for the rest of the fields depends on database vendor
and is described in the installation guide in more detail.
Before applying update or validation operation, Liquibase
ChangeLogService needs to be reset to forget about previously set
change log table. Reason is that the factory creating the
ChangeLogService caches this service per DB connection, not per
Liquibase object, hence changes in name of change log table needed for
custom JpaEntityProvider are not reflected and use only the first
change log table name, i.e. the change log table of the main database.
Reflect in the SQL script that custom JpaEntityProviders have their
own changelog tables, and issue DDL commands to create them when
initializing a new database.
The DB up-to-date check uses Liquibase.listUnrunChangeSets() that in
its available variants unconditionally creates a DatabaseChangeLog
tables. Until the variant of listUnrunChangeSets() that suppresses this
behaviour is made public [1] (currently it is protected), workaround
has been implemented that invokes less invasive variant of
listUnrunChangeSets() via reflection.
[1] https://liquibase.jira.com/browse/CORE-2919
Creation of database table DatabaseChangeLog was omitted from SQL
script which prevented creation of the database from scratch. The fix
adds DDL commands to create the table to the output SQL script in case
of empty database initialization.
Please note that DatabaseChangeLogLock is intentionally omitted. It is
created automatically before the update is even executed because a lock
is acquired (thus the table is properly created if it does not exist)
before check for up-to-dateness of database and potential migration in
KeycloakApplication constructor.