Skip to content
This repository was archived by the owner on Mar 3, 2026. It is now read-only.

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

flyway

Evolve your Database Schema easily and reliably across all your instances.

This module run Flyway on startup and apply database migration.

dependency

<dependency>
  <groupId>org.jooby</groupId>
  <artifactId>jooby-flyway</artifactId>
  <version>1.1.3</version>
</dependency>

usage

flyway.url = ...
flyway.user = ...
flyway.password = ...
{
  use(new Jdbc());

  use(new Flywaydb());
}

If for any reason you need to maintain two or more databases:

flyway.db1.url = "..."
flyway.db1.locations = db1/migration

flyway.db2.url = "..."
flyway.db2.locations = db2/migration
{
  use(new Flywaydb("flyway.db1"));
  use(new Flywaydb("flyway.db2"));
}

migration scripts

Flyway looks for migration scripts at the db/migration classpath location. We recommend to use Semantic versioning for naming the migration scripts:

v0.1.0_My_description.sql
v0.1.1_My_small_change.sql

commands

It is possible to run Flyway commands on startup, default command is: migrate.

If you need to run multiple commands, set the flyway.run property:

flyway.run = [clean, migrate, validate, info]

configuration

Configuration is done via application.conf under the flyway.* path. There are some defaults setting that you can see in the appendix.

For more information, please visit the Flyway site.