The Flyway Database Installer is a generic java application that will create and update databases using the supplied Flyway change log.
The installer is run via command line. The migration files and dependencies of the util-flywayinstaller-cli jar are expected in the classpath.
The following arguments can be specified:
db.host: Specifies the host name. e.g. localhostdb.port: Specifies the server port. e.g. 5432db.user: Specifies the username to access the database.db.adminDbName: (Optional) Specifies the admin database used to connect for existence checks and creation. Defaults to 'postgres' if not provided.db.secretKeys: Specifies the secret keys used to access the database, separated by commas. The first non-empty secret value found for any of these keys will be used.db.name: Specifies the name of the database to be created or updated.db.schema: (Optional) Specifies the database schema to be used. If not specified, the default schema for the database will be used.db.collation: (Optional) Specifies the collation setting when creating the database. Valid options are: [C,UTF_8]. If not specified, the database default collation will be used.log: Specifies the logging level of the installer. Valid options are: [DEBUG, INFO, WARNING, ERROR, OFF]db.tablespace: (Optional) Specifies the tablespace to use when creating the database, if applicable. If not specified, the default tablespace will be used.
The command to run the jar will be in the following format, where the migration files are in db/migration:
java -cp "*:db" com.github.cafapi.util.flywayinstaller.Application [arguments]
For example:
java -cp "*:db" com.github.cafapi.util.flywayinstaller.Application -db.host localhost -db.port 5437 -db.user postgres -db.secretKeys CAF_SERVICE_DATABASE_PASSWORD -db.name test-db2 --db.schema test_schema -log DEBUG