[keycloak-dev] thoughts on file migration?
Bill Burke
bburke at redhat.com
Tue Nov 21 17:51:40 EST 2017
I added a method to Migration interface. Migration.migrateImport()
that takes a RealmModel as a parameter.
Also added a static method to MigrationModelManager.migrateImport().
This method is called if a RealmRepresentation has "keycloakVersion"
set. It loops through all migrators and calls migrateImport passing
in the realm. New migrations must implement this.
There's new test classes for this under the migration/ directory. PR incoming.
On Fri, Oct 27, 2017 at 5:48 AM, Marek Posolda <mposolda at redhat.com> wrote:
> We have version already. It's "keycloakVersion" property on
> RealmRepresentation and it's added during export. This was added in
> 1.9.2.Final, so all the realm JSON exported in 1.9.2 or later will have that
> available . See https://issues.jboss.org/browse/KEYCLOAK-2613 .
>
> But it's not used anywhere until now. The problem are hand-written JSON
> files, which don't contain the "keycloakVersion" and they also don't contain
> required built-in objects. So we're usually trying to decide what built-in
> objects should be automatically added/updated during import on some
> best-effort basis, which sometimes doesn't work (especially if new role was
> added to some existing built-in client etc) .
>
> Maybe we can:
> - Decide if JSON was hand-written based on the "keycloakVersion" present or
> not.
> - For hand-written JSON, add the built-in objects automatically
> - For exported JSON, use the proper migrators. We know the version, so we
> know what migrators to run.
>
> Is it what you meant?
>
> Marek
>
>
> On 26/10/17 23:07, Bill Burke wrote:
>>
>> Need input on this JIRA:
>>
>> https://issues.jboss.org/browse/KEYCLOAK-4715
>>
>> The problem is that our json exports do not have a version assigned to
>> them and we may have org.keycloak.migration.migrators.Migration
>> objects that need to run.
>>
>> Should we force people doing upgrades in this way to add a version tag
>> somewhere in the json? We should then add a "fromJson" MIgration
>> method to be invoked for each appropriate migrator.
>>
>> That sound like a plan?
>>
>
--
Bill Burke
Red Hat
More information about the keycloak-dev
mailing list