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

Fix Liquibase configuration (diff when JPA entities not modified) #54

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* Liquibase H2 database init script
* Due to some differences between H2 and PostgreSQL dialects, even with H2 compatibility mode,
* we need to add some little "hacks" to not have errors like "unknown type".
*/;
/*keep these semi-colon for not having comments in output logs*/;

/* There is some datatypes H2 in compatibility mode don't take into account, so we create a domain/alias of equivalent type */;
CREATE DOMAIN IF NOT EXISTS JSONB AS JSON;
11 changes: 8 additions & 3 deletions powsybl-parent/powsybl-parent-ws/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<git-id.failOnUnableToExtractRepoInfo>false</git-id.failOnUnableToExtractRepoInfo>

<!-- for liquibase plugin -->
<liquibase-core.version>4.20.0</liquibase-core.version>
<liquibase-plugin.version>4.20.0</liquibase-plugin.version>
<!--
liquibase-hibernate6 4.20 (the same as liquibase-core) generates useless changesets, 4.23.2 doesn't seem to have this problem.
for example, but maybe there are more
Expand All @@ -74,7 +74,7 @@
<liquibase-diff.outputFile>src/main/resources/db/changelog/changesets/changelog_${maven.build.timestamp}.xml</liquibase-diff.outputFile>
<liquibase.username>sa</liquibase.username>
<liquibase.databaseDriver>org.h2.Driver</liquibase.databaseDriver>
<liquibase.databaseUrl>jdbc:h2:./target/dummyDB</liquibase.databaseUrl>
<liquibase.databaseUrl>jdbc:h2:./target/dummyDB;MODE=PostgreSQL;DEFAULT_NULL_ORDERING=HIGH;INIT=runscript from 'classpath:/powsybl-build-tools/liquibase-h2-init.sql'</liquibase.databaseUrl>
<liquibase.referenceDatabaseUrl>hibernate:spring:${liquibase-hibernate-package}?dialect=org.hibernate.dialect.PostgreSQLDialect&amp;hibernate.physical_naming_strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy&amp;hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy</liquibase.referenceDatabaseUrl>
<liquibase.referenceDatabaseDriver>liquibase.ext.hibernate.database.connection.HibernateDriver</liquibase.referenceDatabaseDriver>
<liquibase-hibernate-package>PROPERTY_TO_BE_DEFINED_IN_PROJECTS</liquibase-hibernate-package>
Expand Down Expand Up @@ -176,7 +176,7 @@ jib.to.image = finalName;
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase-core.version}</version>
<version>${liquibase-plugin.version}</version>
<configuration>
<changeLogFile>src/main/resources/db/changelog/db.changelog-master.yaml</changeLogFile>
<diffChangeLogFile>${liquibase-diff.outputFile}</diffChangeLogFile>
Expand All @@ -203,6 +203,11 @@ jib.to.image = finalName;
<artifactId>jakarta.validation-api</artifactId>
<version>${validation-api.version}</version>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-build-tools</artifactId>
<version>${powsybl-build-tools.version}</version>
</dependency>
</dependencies>

</plugin>
Expand Down