1000kit liquibase maven plugin to generate the DIFF
of the postgresql database.
The plugin will execute this steps:
- Start docker two postgresql container.
- Start the
Hibernate
entity manager withcreate-drop
flag. This will apply all theHibernate
changes to thetarget
database. - Apply existing Liquibase changes to the
source
database. If there is notchangeLog
file in thesrc/main/resource/db
directory the update will be not execute. - Compare the
source
andtarget
database. The result of the execution will be in thetarget/liquibase-diff-changeLog.xml
file.
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-diff
The 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-check
Check command will validate target/liquibase-diff-changeLog.xml
file.