[keycloak-dev] thoughts on file migration?

Marek Posolda mposolda at redhat.com
Fri Oct 27 05:48:56 EDT 2017


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?
>



More information about the keycloak-dev mailing list