Skip to content

agileek/java-checksum-flyway-maven-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

java-checksum-flyway-maven-plugin

MIT licensed Build Status codecov

Goal

The goal of this project is to help you generate checksum for your java migration using flyway.

There is a file checksum stored in the schema_version table, but only for the .sql

You have to provide your own checksum for java files.

This plugin scans the db/migration folder looking for java migrations, and for each one, compute an md5sum and add it to the JavaMigrationChecksums enum

Usages

Simply put this in your pom

    <plugin>
        <groupId>io.github.agileek</groupId>
        <artifactId>java-checksum-flyway-maven-plugin</artifactId>
        <version>1.0-SNAPSHOT</version>
        <executions>
            <execution>
                <goals>
                    <goal>generate</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

This will generate a file ${project.build.directory}/generated-sources/io/github/agileek/flywayJavaMigrationChecksums and you can use it in your java migrations

In your migration class, implement MigrationChecksumProvider then

    @Override
    public Integer getChecksum() {
        return JavaMigrationChecksums.valueOf(getClass().getSimpleName()).getChecksum();
    }

Parameters

The parameters are:

  • location
    • defaultValue = "/db/migration"
  • locations
    • defaultValue = "/db/migration"
  • outputDirectory
    • defaultValue = "${project.build.directory}/generated-sources"