https://github.com/bootique/bootique-flyway
Bootique integration with Flyway
https://github.com/bootique/bootique-flyway
Last synced: about 1 year ago
JSON representation
Bootique integration with Flyway
- Host: GitHub
- URL: https://github.com/bootique/bootique-flyway
- Owner: bootique
- License: apache-2.0
- Created: 2016-12-06T13:43:51.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-04-19T13:26:57.000Z (about 1 year ago)
- Last Synced: 2025-04-19T18:03:31.634Z (about 1 year ago)
- Language: Java
- Homepage: http://bootique.io
- Size: 161 KB
- Stars: 5
- Watchers: 6
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/bootique/bootique-flyway/actions/workflows/maven.yml)
[](https://search.maven.org/artifact/io.bootique.flyway/bootique-flyway/)
# bootique-flyway
Provides [Flyway](https://flywaydb.org/) migrations framework integration with [Bootique](http://bootique.io).
See usage example [bootique-flyway-demo](https://github.com/bootique-examples/bootique-flyway-demo).
# Setup
## Add bootique-flyway to your build tool:
**Maven**
```xml
io.bootique.bom
bootique-bom
3.0-M4
pom
import
io.bootique.flyway
bootique-flyway
```
**Gradle**
```groovy
compile("io.bootique.flyway:bootique-flyway:1.0")
```
*Note:* **bootique-flyway** is a part of [bootique-bom](https://github.com/bootique/bootique-bom), and version can be
imported from there.
## Available commands
### FLYWAY COMMANDS AS OPTIONS
Flyway is based around just 6 commands: Migrate, Clean, Info, Validate, Baseline and Repair. They are represented in
the Bootique-Flyway module as command line options.
```
-b, --baseline
Baselines an existing database, excluding all migrations up to and including baselineVersion.
--clean
Drops all objects (tables, views, procedures, triggers, ...) in the configured schemas.The schemas are cleaned in the order specified by the schemas property.
-i, --info
Prints the details and status information about all the migrations.
-m, --migrate
Migrates the schema to the latest version. Flyway will create the metadata table automatically if it doesn't exist.
-r, --repair
Repairs the metadata table.
-v, --validate
Validate applied migrations against resolved ones (on the filesystem or classpath) to detect accidental changes that may prevent the schema(s) from being recreated exactly.
```
### BOOTIQUE OPTIONS
The standard Bootique command line options you may need:
```
-c yaml_location, --config=yaml_location
Specifies YAML config location, which can be a classpath (prefixed by classpath:), file path or a URL.
-H, --help-config
Prints information about application modules and their configuration
options.
```
## Configuration
### YAML configuration file
As an example here a YAML test config file: classpath:io/bootique/flyway/explicitNonDefaultMigrationConfigfile.yml.
```
jdbc:
test:
url: jdbc:h2:mem:defaultMigration
username: bogus
password: bogus
driverClassName: org.h2.Driver
flyway:
locations:
- bogus
configFiles:
- classpath:io/bootique/flyway/explicitNonDefaultMigrationConfigfile.conf
dataSources:
- test
```
Only three flyway options are recognized:
- locations: a list of Flyway locations to look for Flyway migrations
- configFiles: a list of Flyway configuraton files (as custom config files, see https://flywaydb.org/documentation/commandline/)
- dataSources: a list of JDBC connections
Using custom config files allows you to more easily run Flyway using a file
for database connection settings (the Bootique YAML file) and application
settings in a Flyway file.
In this example the locations property (with bogus as a non-existent location)
is superseded by the settings in the Flyway configuration file.
### Flyway configuration file
As an example here a Flyway test configuration file: classpath:io/bootique/flyway/explicitNonDefaultMigrationConfigfile.conf.
```
flyway.locations = path/migration
```
## Example Project
[bootique-flyway-demo](https://github.com/bootique-examples/bootique-flyway-demo)