bootique-flyway-example: example flyway code.

Example project for show usage and testing of flyway applications.

License

License

Categories

Categories

Flyway Data Databases Bootique User Interface Web Frameworks
GroupId

GroupId

io.bootique.flyway
ArtifactId

ArtifactId

bootique-flyway-example
Last Version

Last Version

0.2
Release Date

Release Date

Type

Type

jar
Description

Description

bootique-flyway-example: example flyway code.
Example project for show usage and testing of flyway applications.
Project Organization

Project Organization

ObjectStyle LLC

Download bootique-flyway-example

How to add to project

<!-- https://jarcasting.com/artifacts/io.bootique.flyway/bootique-flyway-example/ -->
<dependency>
    <groupId>io.bootique.flyway</groupId>
    <artifactId>bootique-flyway-example</artifactId>
    <version>0.2</version>
</dependency>
// https://jarcasting.com/artifacts/io.bootique.flyway/bootique-flyway-example/
implementation 'io.bootique.flyway:bootique-flyway-example:0.2'
// https://jarcasting.com/artifacts/io.bootique.flyway/bootique-flyway-example/
implementation ("io.bootique.flyway:bootique-flyway-example:0.2")
'io.bootique.flyway:bootique-flyway-example:jar:0.2'
<dependency org="io.bootique.flyway" name="bootique-flyway-example" rev="0.2">
  <artifact name="bootique-flyway-example" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.bootique.flyway', module='bootique-flyway-example', version='0.2')
)
libraryDependencies += "io.bootique.flyway" % "bootique-flyway-example" % "0.2"
[io.bootique.flyway/bootique-flyway-example "0.2"]

Dependencies

compile (4)

Group / Artifact Type Version
io.bootique : bootique jar 0.22
io.bootique.flyway : bootique-flyway jar 0.2
com.h2database : h2 jar 1.4.193
io.bootique.logback : bootique-logback jar 0.14

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.mockito : mockito-core jar 2.0.31-beta

Project Modules

There are no modules declared in this project.

Build Status Maven Central

bootique-flyway

Provides Flyway migrations framework integration with Bootique. See usage example bootique-flyway-demo.

Setup

Add bootique-flyway to your build tool:

Maven

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.bootique.bom</groupId>
            <artifactId>bootique-bom</artifactId>
            <version>2.0.M1</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependency>
    <groupId>io.bootique.flyway</groupId>
    <artifactId>bootique-flyway</artifactId>
</dependency>

Gradle

compile("io.bootique.flyway:bootique-flyway:1.0")

Note: bootique-flyway is a part of 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

io.bootique.flyway

Bootique Project

Bootique is a minimally opinionated platform for modern runnable Java apps

Versions

Version
0.2
0.1