Evolve your Database Schema easily and reliably across all your instances.
This module run Flyway on startup and apply database migration.
NOTE: This module depends on jdbc module so all the services provided by the jdbc module.
<dependency>
<groupId>org.jooby</groupId>
<artifactId>jooby-flyway</artifactId>
<version>1.2.1</version>
</dependency>{
use(new Jdbc());
use(new Flywaydb());
}If for any reason you need to maintain two or more databases:
{
use(new Jdbc("db1"));
use(new Flywaydb("db1"));
use(new Jdbc("db2"));
use(new Flywaydb("db2"));
}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
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 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.