diff --git a/generators/quarkus/resources/gradle/libs.versions.toml b/generators/quarkus/resources/gradle/libs.versions.toml
index 15885abd..50a0fcf8 100644
--- a/generators/quarkus/resources/gradle/libs.versions.toml
+++ b/generators/quarkus/resources/gradle/libs.versions.toml
@@ -6,7 +6,7 @@ commons-vfs2 = { group = "org.apache.commons", name = "commons-vfs2", version =
graal = { group = "org.graalvm.nativeimage", name = "svm", version = "24.1.1" }
mapstruct = { group = "org.mapstruct", name = "mapstruct", version = "1.6.3" }
mapstruct-processor = { group = "org.mapstruct", name = "mapstruct-processor", version = "1.6.3" }
-mongock-bom = { group = "com.github.cloudyrock.mongock", name = "mongock-bom", version = "4.3.8" }
+mongock-bom = { group = "io.mongock", name = "mongock-bom", version = "5.5.0" }
quarkus-resteasy-problem = { group = "com.tietoevry.quarkus", name = "quarkus-resteasy-problem", version = "3.9.0" }
wiremock = { group = "com.github.tomakehurst", name = "wiremock-jre8", version = "3.0.1" }
testcontainers-keycloak = { group = "com.github.dasniko", name = "testcontainers-keycloak", version = "3.5.1" }
diff --git a/generators/quarkus/resources/pom.xml b/generators/quarkus/resources/pom.xml
index ebfa173f..7d303654 100644
--- a/generators/quarkus/resources/pom.xml
+++ b/generators/quarkus/resources/pom.xml
@@ -30,11 +30,11 @@
1.15.0
3.2.3
3.11.0
- 4.3.8
+ 5.5.0
2.9.0
23.1.2
10.17.0
-
\ No newline at end of file
+
diff --git a/generators/quarkus/templates/build.gradle.ejs b/generators/quarkus/templates/build.gradle.ejs
index 0f1ae283..7116a204 100644
--- a/generators/quarkus/templates/build.gradle.ejs
+++ b/generators/quarkus/templates/build.gradle.ejs
@@ -245,8 +245,8 @@ dependencies {
<%_ } _%>
<%_ if (databaseType === 'mongodb') { _%>
implementation "io.quarkus:quarkus-mongodb-panache"
- implementation "com.github.cloudyrock.mongock:mongock-standalone"
- implementation "com.github.cloudyrock.mongock:mongodb-sync-v4-driver"
+ implementation "io.mongock:mongock-standalone"
+ implementation "io.mongock:mongodb-sync-v4-driver"
implementation "org.apache.commons:commons-lang3"
implementation "org.apache.commons:commons-vfs2:${commons_vfs2_version}"
compileOnly "org.graalvm.nativeimage:svm:${graal_version}"
@@ -286,7 +286,7 @@ dependencies {
implementation "com.tietoevry.quarkus:quarkus-resteasy-problem:${resteasy_problem_version}"
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
<%_ if (databaseType === 'mongodb') { _%>
- implementation enforcedPlatform("com.github.cloudyrock.mongock:mongock-bom:${mongockBom_version}")
+ implementation enforcedPlatform("io.mongock:mongock-bom:${mongockBom_version}")
<%_ } _%>
annotationProcessor "org.mapstruct:mapstruct-processor:${mapstruct_version}"
diff --git a/generators/quarkus/templates/partials/data_pom.xml.ejs b/generators/quarkus/templates/partials/data_pom.xml.ejs
index 9cad54b9..da13e69d 100644
--- a/generators/quarkus/templates/partials/data_pom.xml.ejs
+++ b/generators/quarkus/templates/partials/data_pom.xml.ejs
@@ -69,11 +69,11 @@
quarkus-mongodb-panache
- com.github.cloudyrock.mongock
+ io.mongock
mongock-standalone
- com.github.cloudyrock.mongock
+ io.mongock
mongodb-sync-v4-driver
diff --git a/generators/quarkus/templates/pom.xml.ejs b/generators/quarkus/templates/pom.xml.ejs
index 4d60d213..9ab437f7 100644
--- a/generators/quarkus/templates/pom.xml.ejs
+++ b/generators/quarkus/templates/pom.xml.ejs
@@ -101,7 +101,7 @@
<%_ if (databaseType === 'mongodb') { _%>
- com.github.cloudyrock.mongock
+ io.mongock
mongock-bom
${mongock-bom.version}
pom
diff --git a/generators/quarkus/templates/src/main/java/_package_/config/MongockConfiguration.java.ejs b/generators/quarkus/templates/src/main/java/_package_/config/MongockConfiguration.java.ejs
index be02a05b..6cdc02c3 100644
--- a/generators/quarkus/templates/src/main/java/_package_/config/MongockConfiguration.java.ejs
+++ b/generators/quarkus/templates/src/main/java/_package_/config/MongockConfiguration.java.ejs
@@ -18,9 +18,9 @@
-%>
package <%=packageName%>.config;
-import com.github.cloudyrock.mongock.MongockAnnotationProcessor;
-import com.github.cloudyrock.mongock.driver.mongodb.sync.v4.driver.MongoSync4Driver;
-import com.github.cloudyrock.standalone.MongockStandalone;
+import io.mongock.driver.mongodb.sync.v4.driver.MongoSync4Driver;
+import io.mongock.runner.standalone.MongockStandalone;
+import io.mongock.api.annotations.ChangeUnit;
import com.mongodb.MongoClientSettings;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
@@ -43,25 +43,17 @@ public class MongockConfiguration {
@Inject
MongoClient mongoClient;
- private static final List> changeLogs;
-
- static {
- changeLogs = new MongockAnnotationProcessor().getChangeLogAnnotationClass()
- .stream()
- .flatMap(changeLogClass ->
- new Reflections("<%=packageName%>.config.dbmigrations").getTypesAnnotatedWith(changeLogClass).stream()
- )
- .collect(Collectors.toList());
- }
-
@ConfigProperty(name = "quarkus.mongodb.database")
String databaseName;
void onStart(@Observes StartupEvent ev) {
+ var driver = MongoSync4Driver.withDefaultLock(mongoClient, databaseName);
+ driver.disableTransaction();
+
MongockStandalone
.builder()
- .setDriver(MongoSync4Driver.withDefaultLock(mongoClient, databaseName))
- .addChangeLogClasses(changeLogs)
+ .setDriver(driver)
+ .addMigrationScanPackage("<%=packageName%>.config.dbmigrations")
.buildRunner()
.execute();
}
@@ -70,10 +62,11 @@ public class MongockConfiguration {
private static class NativeSupport implements Feature {
@Override
public void beforeAnalysis(BeforeAnalysisAccess access) {
- changeLogs.forEach(clazz -> {
- RuntimeReflection.register(clazz);
- RuntimeReflection.register(clazz.getConstructors());
- RuntimeReflection.register(clazz.getMethods());
+ new Reflections("<%=packageName%>.config.dbmigrations")
+ .getTypesAnnotatedWith(ChangeUnit.class).forEach(clazz -> {
+ RuntimeReflection.register(clazz);
+ RuntimeReflection.register(clazz.getConstructors());
+ RuntimeReflection.register(clazz.getMethods());
});
}
}
diff --git a/generators/quarkus/templates/src/main/java/_package_/config/dbmigrations/InitialSetupMigration.java.ejs b/generators/quarkus/templates/src/main/java/_package_/config/dbmigrations/InitialSetupMigration.java.ejs
index 6de0c5b4..159ce920 100644
--- a/generators/quarkus/templates/src/main/java/_package_/config/dbmigrations/InitialSetupMigration.java.ejs
+++ b/generators/quarkus/templates/src/main/java/_package_/config/dbmigrations/InitialSetupMigration.java.ejs
@@ -21,8 +21,9 @@ package <%=packageName%>.config.dbmigrations;
import static org.bson.codecs.configuration.CodecRegistries.fromProviders;
import static org.bson.codecs.configuration.CodecRegistries.fromRegistries;
-import com.github.cloudyrock.mongock.ChangeLog;
-import com.github.cloudyrock.mongock.ChangeSet;
+import io.mongock.api.annotations.ChangeUnit;
+import io.mongock.api.annotations.Execution;
+import io.mongock.api.annotations.RollbackExecution;
import com.mongodb.MongoClientSettings;
import com.mongodb.client.MongoDatabase;
import <%=packageName%>.security.AuthoritiesConstants;
@@ -38,11 +39,17 @@ import org.bson.codecs.pojo.PojoCodecProvider;
/**
* Creates the initial database setup.
*/
-@ChangeLog(order = "001")
+@ChangeUnit(id="users-initialization", order = "001")
public class InitialSetupMigration {
- @ChangeSet(order = "01", author = "initiator", id = "01-addAuthorities")
- public void addAuthorities(MongoDatabase db) {
+ private final MongoDatabase db;
+
+ public InitialSetupMigration(MongoDatabase db) {
+ this.db = db;
+ }
+
+ @Execution
+ public void addAuthorities() {
Authority adminAuthority = new Authority(AuthoritiesConstants.ADMIN);
Authority userAuthority = new Authority(AuthoritiesConstants.USER);
@@ -51,11 +58,14 @@ public class InitialSetupMigration {
.getCollection("jhi_authority", Authority.class)
.withCodecRegistry(getCodecRegistry())
.insertMany(Arrays.asList(adminAuthority, userAuthority));
+
+ <%_ if (authenticationType !== 'oauth2') { _%>
+ addUsers();
+ <%_ } _%>
}
<%_ if (authenticationType !== 'oauth2') { _%>
- @ChangeSet(order = "02", author = "initiator", id = "02-addUsers")
- public void addUsers(MongoDatabase db) {
+ public void addUsers() {
Authority adminAuthority = new Authority(AuthoritiesConstants.ADMIN);
Authority userAuthority = new Authority(AuthoritiesConstants.USER);
@@ -113,4 +123,7 @@ public class InitialSetupMigration {
CodecProvider pojoCodecProvider = PojoCodecProvider.builder().automatic(true).build();
return fromRegistries(MongoClientSettings.getDefaultCodecRegistry(), fromProviders(pojoCodecProvider));
}
+
+ @RollbackExecution
+ public void rollback() {}
}
diff --git a/generators/quarkus/templates/src/test/java/_package_/_entityPackage_/_partials/imports.ejs b/generators/quarkus/templates/src/test/java/_package_/_entityPackage_/_partials/imports.ejs
index c4d69829..acf0b2a1 100644
--- a/generators/quarkus/templates/src/test/java/_package_/_entityPackage_/_partials/imports.ejs
+++ b/generators/quarkus/templates/src/test/java/_package_/_entityPackage_/_partials/imports.ejs
@@ -23,8 +23,8 @@ import static jakarta.ws.rs.core.Response.Status.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.*;
<%_ if (databaseType === 'mongodb') { _%>
-import com.github.cloudyrock.mongock.driver.mongodb.sync.v4.driver.MongoSync4Driver;
-import com.github.cloudyrock.standalone.MongockStandalone;
+import io.mongock.driver.mongodb.sync.v4.driver.MongoSync4Driver;
+import io.mongock.runner.standalone.MongockStandalone;
import com.mongodb.client.MongoClient;
<%_ } _%>
diff --git a/generators/quarkus/templates/src/test/java/_package_/web/rest/AccountResourceTest_jwt.java.ejs b/generators/quarkus/templates/src/test/java/_package_/web/rest/AccountResourceTest_jwt.java.ejs
index bf104302..cdf06b11 100644
--- a/generators/quarkus/templates/src/test/java/_package_/web/rest/AccountResourceTest_jwt.java.ejs
+++ b/generators/quarkus/templates/src/test/java/_package_/web/rest/AccountResourceTest_jwt.java.ejs
@@ -27,8 +27,8 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.*;
import static org.junit.jupiter.api.Assertions.fail;
<%_ if (databaseType === 'mongodb') { _%>
-import com.github.cloudyrock.mongock.driver.mongodb.sync.v4.driver.MongoSync4Driver;
-import com.github.cloudyrock.standalone.MongockStandalone;
+import io.mongock.driver.mongodb.sync.v4.driver.MongoSync4Driver;
+import io.mongock.runner.standalone.MongockStandalone;
import com.mongodb.client.MongoClient;
<%_ } _%>
diff --git a/generators/quarkus/templates/src/test/java/_package_/web/rest/AccountResourceTest_oauth2.java.ejs b/generators/quarkus/templates/src/test/java/_package_/web/rest/AccountResourceTest_oauth2.java.ejs
index b60ddbe6..4dacfcc3 100644
--- a/generators/quarkus/templates/src/test/java/_package_/web/rest/AccountResourceTest_oauth2.java.ejs
+++ b/generators/quarkus/templates/src/test/java/_package_/web/rest/AccountResourceTest_oauth2.java.ejs
@@ -28,8 +28,8 @@ import io.restassured.common.mapper.TypeRef;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
<%_ if (databaseType === 'mongodb') { _%>
-import com.github.cloudyrock.mongock.driver.mongodb.sync.v4.driver.MongoSync4Driver;
-import com.github.cloudyrock.standalone.MongockStandalone;
+import io.mongock.driver.mongodb.sync.v4.driver.MongoSync4Driver;
+import io.mongock.runner.standalone.MongockStandalone;
import com.mongodb.client.MongoClient;
<%_ } _%>
diff --git a/generators/quarkus/templates/src/test/java/_package_/web/rest/AuthorityResourceTest.java.ejs b/generators/quarkus/templates/src/test/java/_package_/web/rest/AuthorityResourceTest.java.ejs
index 78d30baa..05be4013 100644
--- a/generators/quarkus/templates/src/test/java/_package_/web/rest/AuthorityResourceTest.java.ejs
+++ b/generators/quarkus/templates/src/test/java/_package_/web/rest/AuthorityResourceTest.java.ejs
@@ -19,8 +19,8 @@
package <%=packageName%>.web.rest;
<%_ if (databaseType === 'mongodb') { _%>
-import com.github.cloudyrock.mongock.driver.mongodb.sync.v4.driver.MongoSync4Driver;
-import com.github.cloudyrock.standalone.MongockStandalone;
+import io.mongock.driver.mongodb.sync.v4.driver.MongoSync4Driver;
+import io.mongock.runner.standalone.MongockStandalone;
import com.mongodb.client.MongoClient;
import org.eclipse.microprofile.config.inject.ConfigProperty;
<%_ } _%>
diff --git a/generators/quarkus/templates/src/test/java/_package_/web/rest/UserResourceTest.java.ejs b/generators/quarkus/templates/src/test/java/_package_/web/rest/UserResourceTest.java.ejs
index d1559196..9d01c104 100644
--- a/generators/quarkus/templates/src/test/java/_package_/web/rest/UserResourceTest.java.ejs
+++ b/generators/quarkus/templates/src/test/java/_package_/web/rest/UserResourceTest.java.ejs
@@ -26,8 +26,8 @@ import static jakarta.ws.rs.core.Response.Status.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.*;
<%_ if (databaseType === 'mongodb') { _%>
-import com.github.cloudyrock.mongock.driver.mongodb.sync.v4.driver.MongoSync4Driver;
-import com.github.cloudyrock.standalone.MongockStandalone;
+import io.mongock.driver.mongodb.sync.v4.driver.MongoSync4Driver;
+import io.mongock.runner.standalone.MongockStandalone;
import com.mongodb.client.MongoClient;
<%_ } _%>