Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bootique/bootique-flyway

Bootique integration with Flyway
https://github.com/bootique/bootique-flyway

Last synced: about 2 months ago
JSON representation

Bootique integration with Flyway

Awesome Lists containing this project

README

        

[![build test deploy](https://github.com/bootique/bootique-flyway/actions/workflows/maven.yml/badge.svg)](https://github.com/bootique/bootique-flyway/actions/workflows/maven.yml)
[![Maven Central](https://img.shields.io/maven-central/v/io.bootique.flyway/bootique-flyway.svg?colorB=brightgreen)](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)