diff --git a/pom.xml b/pom.xml
index b476c9a..f57c907 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
UTF-8
io.phasetwo.keycloak.events
4.13.2
- 23.0.3
+ 23.0.4
1.18.30
1.1.1
https://s01.oss.sonatype.org
diff --git a/src/main/java/io/phasetwo/keycloak/resources/EventsResourceProviderFactory.java b/src/main/java/io/phasetwo/keycloak/resources/EventsResourceProviderFactory.java
index ff6caff..fe97cde 100644
--- a/src/main/java/io/phasetwo/keycloak/resources/EventsResourceProviderFactory.java
+++ b/src/main/java/io/phasetwo/keycloak/resources/EventsResourceProviderFactory.java
@@ -38,7 +38,10 @@ public void postInit(KeycloakSessionFactory factory) {
if (event instanceof RealmModel.RealmPostCreateEvent) {
realmPostCreate((RealmModel.RealmPostCreateEvent) event);
} else if (event instanceof PostMigrationEvent) {
- KeycloakModelUtils.runJobInTransaction(factory, this::initRoles);
+ if (System.getenv("KC_ORGS_SKIP_MIGRATION") == null) {
+ log.info("initializing event roles following migration");
+ KeycloakModelUtils.runJobInTransaction(factory, this::initRoles);
+ }
}
});
}