Skip to content

Commit

Permalink
- fix ddl's
Browse files Browse the repository at this point in the history
  • Loading branch information
pefernan committed Sep 20, 2024
1 parent 6c2196e commit 76a4933
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/src/main/resources/db/data-index/postgresql/*
29 changes: 29 additions & 0 deletions data-index/data-index-storage/data-index-storage-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
<name>Kogito Apps :: Data Index Storage JPA compatible DBs</name>

<properties>
<path.to.postgresql.storage>../data-index-storage-postgresql</path.to.postgresql.storage>
<path.to.script.folder>src/main/resources/db/</path.to.script.folder>
<path.to.migration.scripts.from>${path.to.postgresql.storage}/${path.to.script.folder}/data-index/postgresql</path.to.migration.scripts.from>
<path.to.migration.scripts.to>${path.to.script.folder}/data-index/postgresql</path.to.migration.scripts.to>
<java.module.name>org.kie.kogito.index.jpa</java.module.name>
</properties>

Expand Down Expand Up @@ -115,6 +119,31 @@
</execution>
</executions>
</plugin>
<!-- The cleanest way would be to use the maven-dependency-plugin to unpack and copy scripts from the built artifact `kie-addons-persistence-jdbc` but there's a limitation to using this only in the `package` phase whereas we need that into the `generate-sources` phase. See also https://issues.apache.org/jira/browse/MDEP-98 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resource-one</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${path.to.migration.scripts.to}</outputDirectory>
<resources>
<resource>
<directory>${path.to.migration.scripts.from}</directory>
<includes>
<include>*.sql</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
1 change: 1 addition & 0 deletions jobs-service/jobs-service-storage-jpa/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/src/main/resources/db/jobs-service/postgresql/*
3 changes: 3 additions & 0 deletions jobs-service/jobs-service-storage-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@
<resources>
<resource>
<directory>${path.to.migration.scripts.from}</directory>
<includes>
<include>*.sql</include>
</includes>
</resource>
</resources>
</configuration>
Expand Down
51 changes: 46 additions & 5 deletions persistence-commons/kogito-ddl/src/assembly/multi-repo-zip.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,64 @@
</dependencySet>
</dependencySets>
<fileSets>
<!-- Persistence Commons -->
<fileSet>
<directory>${project.root.dir}/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration</directory>
<directory>${project.root.dir}/persistence-commons/persistence-commons-jpa/src/main/resources/db/persistence-commons/ansi</directory>
<outputDirectory>h2/persistence-commons</outputDirectory>
<includes>
<include>*.sql</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.root.dir}/persistence-commons/persistence-commons-postgresql/src/main/resources/db/persistence-commons/postgresql</directory>
<outputDirectory>postgresql/persistence-commons</outputDirectory>
<includes>
<include>*.sql</include>
</includes>
</fileSet>

<!-- Data Index -->
<fileSet>
<directory>${project.root.dir}/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/data-index/ansi</directory>
<outputDirectory>h2/data-index</outputDirectory>
<includes>
<include>*.sql</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.root.dir}/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/data-index/postgresql</directory>
<outputDirectory>postgresql/data-index</outputDirectory>
<includes>
<include>*.sql</include>
</includes>
</fileSet>

<!-- Data Audit -->
<fileSet>
<directory>${project.root.dir}/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/h2</directory>
<outputDirectory>h2/data-audit</outputDirectory>
<includes>
<include>*.sql</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.root.dir}/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/postgresql</directory>
<outputDirectory>postgresql/data-audit</outputDirectory>
<includes>
<include>*.sql</include>
</includes>
</fileSet>

<!-- Job Service -->
<fileSet>
<directory>${project.root.dir}/data-index/data-index-storage/data-index-storage-oracle/src/main/resources/db/migration</directory>
<outputDirectory>oracle/data-index</outputDirectory>
<directory>${project.root.dir}/jobs-service/jobs-service-storage-jpa/src/main/resources/db/jobs-service/ansi</directory>
<outputDirectory>h2/jobs-service</outputDirectory>
<includes>
<include>*.sql</include>
</includes>
</fileSet>
<!-- Job Service DDLs - Flyway scripts -->
<fileSet>
<directory>${project.root.dir}/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service</directory>
<directory>${project.root.dir}/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/postgresql</directory>
<outputDirectory>postgresql/jobs-service</outputDirectory>
<includes>
<include>*.sql</include>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,36 @@
</dependencySet>
</dependencySets>
<fileSets>
<!-- Persistence Commons -->
<fileSet>
<directory>${project.root.dir}/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration</directory>
<directory>${project.root.dir}/persistence-commons/persistence-commons-postgresql/src/main/resources/db/persistence-commons/postgresql</directory>
<outputDirectory>postgresql/persistence-commons</outputDirectory>
<includes>
<include>*.sql</include>
</includes>
</fileSet>

<!-- Data Index -->
<fileSet>
<directory>${project.root.dir}/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/data-index/postgresql</directory>
<outputDirectory>postgresql/data-index</outputDirectory>
<includes>
<include>*.sql</include>
</includes>
</fileSet>
<!-- Job Service DDLs - Flyway scripts -->

<!-- Data Audit -->
<fileSet>
<directory>${project.root.dir}/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/postgresql</directory>
<outputDirectory>postgresql/data-audit</outputDirectory>
<includes>
<include>*.sql</include>
</includes>
</fileSet>

<!-- Job Service -->
<fileSet>
<directory>${project.root.dir}/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service</directory>
<directory>${project.root.dir}/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/postgresql</directory>
<outputDirectory>postgresql/jobs-service</outputDirectory>
<includes>
<include>*.sql</include>
Expand Down
1 change: 1 addition & 0 deletions persistence-commons/persistence-commons-jpa/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/src/main/resources/db/persistence-commons/postgresql/*
29 changes: 29 additions & 0 deletions persistence-commons/persistence-commons-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
<name>Kogito Apps :: Persistence Commons JPA</name>

<properties>
<path.to.postgresql.storage>../persistence-commons-postgresql</path.to.postgresql.storage>
<path.to.script.folder>src/main/resources/db/</path.to.script.folder>
<path.to.migration.scripts.from>${path.to.postgresql.storage}/${path.to.script.folder}/persistence-commons/postgresql</path.to.migration.scripts.from>
<path.to.migration.scripts.to>${path.to.script.folder}/persistence-commons/postgresql</path.to.migration.scripts.to>
<java.module.name>org.kie.kogito.persistence.jpa</java.module.name>
</properties>

Expand Down Expand Up @@ -61,6 +65,31 @@
</execution>
</executions>
</plugin>
<!-- The cleanest way would be to use the maven-dependency-plugin to unpack and copy scripts from the built artifact `kie-addons-persistence-jdbc` but there's a limitation to using this only in the `package` phase whereas we need that into the `generate-sources` phase. See also https://issues.apache.org/jira/browse/MDEP-98 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resource-one</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${path.to.migration.scripts.to}</outputDirectory>
<resources>
<resource>
<directory>${path.to.migration.scripts.from}</directory>
<includes>
<include>*.sql</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 76a4933

Please sign in to comment.