finsta-db-migration-cli-app

A command line app that handles Flyway migrations.

The app has defaults that matches finsta, but it can easily handle other needs.

Build

gw assemble
ll build/libs/finsta-db-migration-cli-app-*-all.jar
cp build/libs/finsta-db-migration-cli-app-*-all.jar cli-app.jar

Show Help

java -jar cli-app.jar -h
java -jar cli-app.jar migrate -h
java -jar cli-app.jar clean -h

Finsta

Migrate finsta

java -jar cli-app.jar migrate --tenants --dry-run                        (1)
java -jar cli-app.jar migrate --tenants                                  (2)
java -jar cli-app.jar migrate --tenants --locations migrations,test-data (3)
java -jar cli-app.jar migrate --schema public                            (4)
java -jar cli-app.jar migrate --schema schema-1 --schema schema-2        (5)
java -jar cli-app.jar migrate --schemas schema-1,schema-2                (6)
1 discover tenant schemas, perform a dry run
2 discover tenant schemas, apply migrations
3 discover tenant schemas, set custom locations
4 migrate a single schema
5 migrate multiple schemas
6 same as 5, different syntax

Clean finsta

java -jar cli-app.jar clean --tenants --dry-run       (1)
java -jar cli-app.jar clean --tenants                 (2)
java -jar cli-app.jar clean --schema my-single-schema (3)
1 discover tenant schemas, perform a dry run
2 discover tenant schemas, wipe everything from the schema
3 clean only the selected schema(s)

Override Defaults

The application connects to the finstadb by default, but this can be customized by passing environment variables.

example using migrations on the file system
java -jar \
  -Dhost=<host> \
  -Dport=<port> \
  -Ddb-name=<db-name> \
  -Dusername=<username> \
  -Dpassword=<password> \
  cli-app.jar migrate --schema global --location filesystem:/path/to/base-dir/global-migrations