1000kit liquibase maven plugin to generate the DIFF of the postgresql database and to validate changes through the Check target.
The plugin will execute this steps:
- Start docker two postgresql container.
- Start the
Hibernateentity manager withcreate-dropflag. This will apply all theHibernatechanges to thetargetdatabase. - Apply existing Liquibase changes to the
sourcedatabase. If there is notchangeLogfile in thesrc/main/resource/dbdirectory the update will be not execute. - Compare the
sourceandtargetdatabase. The result of the execution will be in thetarget/liquibase-diff-changeLog.xmlfile.
Create a profile in your maven project.
<profile>
<id>db-diff</id>
<build>
<plugins>
<plugin>
<groupId>org.tkit.maven</groupId>
<artifactId>tkit-liquibase-plugin</artifactId>
<version>latest-version</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>diff</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>Run maven command in the project directory:
mvn clean compile -Pdb-diffThe result of the execution will be in the target/liquibase-diff-changeLog.xml file.
Create a profile in your maven project.
<profile>
<id>db-check</id>
<build>
<plugins>
<plugin>
<groupId>org.tkit.maven</groupId>
<artifactId>tkit-liquibase-plugin</artifactId>
<version>latest-version</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>check</goal>
</goals>
<phase>validate</phase>
<configuration>
<skipChanges>
<dropTable>table1,table2</dropTable>
<createTable>newTable</createTable>
</skipChanges>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>After you run db-diff run maven command in the project directory:
mvn clean compile -Pdb-diff
mvn clean compile -Pdb-checkCheck command will validate target/liquibase-diff-changeLog.xml file.