Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KOGITO-7676: Implement Flyway DB schema migration #1431

Merged
merged 10 commits into from
Dec 9, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public void start() {
LOGGER.debug("Starting PostgreSQL Quarkus test resource");
properties.clear();
Network network = Network.newNetwork();
postgresql.withInitScript("data_index_postgresql_create.sql");
postgresql.withNetwork(network);
postgresql.withNetworkAliases("postgresql");
postgresql.waitingFor(Wait.forListeningPort());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public void setPostgreSqlURL(String postgreSqlURL, String username, String passw
addEnv("QUARKUS_DATASOURCE_JDBC_URL", postgreSqlURL);
addEnv("QUARKUS_DATASOURCE_USERNAME", username);
addEnv("QUARKUS_DATASOURCE_PASSWORD", password);
addEnv("QUARKUS_FLYWAY_MIGRATE_AT_START", "true");
addEnv("QUARKUS_FLYWAY_BASELINE_ON_MIGRATE", "true");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,6 @@
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<executions>
<execution>
<id>copy-postgresql-file</id>
<phase>generate-sources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<sourceFile>${project.root.dir}/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/data_index_create.sql</sourceFile>
<destinationFile>${project.basedir}/src/main/resources/data_index_postgresql_create.sql</destinationFile>
</configuration>
</execution>
<execution>
<id>rename-oracle-file</id>
<phase>generate-sources</phase>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,6 @@
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<executions>
<execution>
<id>copy-postgresql-file</id>
<phase>generate-sources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<sourceFile>${project.root.dir}/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/data_index_create.sql</sourceFile>
<destinationFile>${project.basedir}/src/main/resources/data_index_postgresql_create.sql</destinationFile>
</configuration>
</execution>
<execution>
<id>rename-oracle-file</id>
<phase>generate-sources</phase>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ protected Map<String, String> getProperties() {
Map<String, String> properties = new HashMap<>();
properties.put(KOGITO_DATA_INDEX_SERVICE_URL, "http://localhost:" + getTestResource().getMappedPort());
properties.putAll(getTestResource().getProperties());
properties.put("spring.flyway.enabled", "true");
properties.put("spring.flyway.baseline-on-migrate", "true");
return properties;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ protected void configurePostgreSQLToService(Collection<GenericContainer<?>> cont
service.addEnv("QUARKUS_DATASOURCE_USERNAME", username);
service.addEnv("QUARKUS_DATASOURCE_PASSWORD", password);
service.addEnv("QUARKUS_DATASOURCE_DB-KIND", "postgresql");
service.addEnv("QUARKUS_FLYWAY_MIGRATE_AT_START", "true");
service.addEnv("QUARKUS_FLYWAY_BASELINE_ON_MIGRATE", "true");
service.addEnv("QUARKUS_FLYWAY_CLEAN_AT_START", "false");
});
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void init(JobServiceTestResource annotation) {
if (annotation.dataIndexEnabled()) {
DataIndexPostgreSqlContainer container = new DataIndexPostgreSqlContainer();
container.addProtoFileFolder();
KogitoPostgreSqlContainer postgresql = new KogitoPostgreSqlContainer().withInitScript("data_index_postgresql_create.sql");
KogitoPostgreSqlContainer postgresql = new KogitoPostgreSqlContainer();
resource.withServiceContainer("data-index", container, postgresql);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,6 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<executions>
<execution>
<id>copy-postgresql-file</id>
<phase>generate-sources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<sourceFile>${project.root.dir}/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/data_index_create.sql</sourceFile>
<destinationFile>${project.basedir}/target/classes/data_index_postgresql_create.sql</destinationFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-container-image-jib</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-flyway</artifactId>
</dependency>

<dependency>
<groupId>org.kie.kogito</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ quarkus.kafka.health.enabled=true
quarkus.kafka.bootstrap-servers=localhost:9092
%dev.kafka.bootstrap.servers=localhost:9092

#Flyway
quarkus.flyway.baseline-on-migrate=true

mp.messaging.incoming.kogito-processinstances-events.connector=smallrye-kafka
mp.messaging.incoming.kogito-processinstances-events.topic=kogito-processinstances-events
mp.messaging.incoming.kogito-processinstances-events.group.id=kogito-data-index-processinstances
Expand Down Expand Up @@ -41,4 +44,4 @@ quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.C

#Container image
quarkus.container-image.build=${quarkus.build.image:true}
quarkus.container-image.group=org.kie.kogito
quarkus.container-image.group=org.kie.kogito

This file was deleted.

Loading