Questions tagged [flyway]

Flyway by Boxfuse is an open-source database migration tool. It strongly favors simplicity and convention over configuration.

Flyway by Redgate is an open-source database migration tool. It strongly favors simplicity and convention over configuration.

It runs on Windows, macOS and Linux, Java and Android.

It is based around just 7 basic commands: Migrate, Clean, Info, Validate, Undo, Baseline and Repair.

Migrations can be written in SQL (database-specific syntax (such as PL/SQL, T-SQL, ...) is supported) or Java (for advanced data transformations or dealing with LOBs).

It has a Command-line client. If you are on the JVM, we recommend using the Java API (also works on Android) for migrating the database on application startup. Alternatively, you can also use the Maven plugin or the Gradle plugin.

And if that not enough, there are plugins available for Spring Boot, Dropwizard, Grails, Play, SBT, Ant, Griffon, Grunt, Ninja and more!

Supported databases are Oracle, SQL Server, DB2, MySQL (including Amazon RDS), Aurora MySQL, Percona XtraDB Cluster, MariaDB, PostgreSQL (including Amazon RDS and Heroku), Aurora PostgreSQL, Redshift, CockroachDB, Informix, H2, HSQLDB, Derby, SQLite, SAP HANA and Sybase ASE.

More info:

2221 questions
14
votes
2 answers

Is it possible to use feature flags/toggles when feature modify database?

This problem confuses me the most when thinking about using feature toggles in applications. Most of the features require some changes in database. How then feature flag can be implemented to be able revert database changes smoothly along with…
Artur Skrzydło
  • 1,135
  • 18
  • 37
14
votes
4 answers

Without using hibernate.hbm2ddl.auto, how do I export all the initial schema into Flyway?

I am at the almost ready stage of my JEE development. With a lot of recommendation NOT to use Hibernate's hbm2ddl.auto in production, I decided to remove it. So now, I found out about Flyway, which seems great for future db changes and migrations,…
VHanded
  • 2,079
  • 4
  • 30
  • 55
14
votes
2 answers

Integration Testing with Flyway

I'm using Flyway to handle the database migration. Everything is working fine: the default location of the migration files is: main/resource/db/migration/V1... I am running integration tests and my setup uses an separate database schema for…
Johny19
  • 5,364
  • 14
  • 61
  • 99
14
votes
1 answer

Flyway concurrent migration

We are having many projects running on many servers looking up into one database, we"re thinking to setup Flyway to every project for control our database structure. But we are worrying about concurrent migration problem, if some projects re-deploy…
Nam Vu
  • 161
  • 1
  • 4
13
votes
3 answers

Failed to ugrade a Spring Boot app to Flyway 7.0.0

I'm trying to upgrade my Spring Boot 2.3.4 app to use Flyway 7.0.0 (the latest version). Previously it was using Flyway 6.5.6. The relevant entries in build.gradle are shown below. buildscript { ext { flywayVersion = "7.0.0" // changed from…
Antonio Dragos
  • 1,973
  • 2
  • 29
  • 52
13
votes
2 answers

Migrating multiple schemas with distinct life-cycle using Flyway and Spring Boot

The Flyway FAQ separates three cases of multiple schemas: Multiple identical schemas The schemas are distinct, but have the same life-cycle The schemas have a distinct life-cycle or must be autonomous and cleanly separated We're building a…
MatanRubin
  • 985
  • 8
  • 16
13
votes
1 answer

Inheriting gradle plugin in subprojects

I want to avoid redundancy and therefore I got one "shared" project that contains looks like this: plugins { id "org.flywaydb.flyway" version "4.2.0" } repositories { mavenCentral() jcenter() } apply plugin: "java" dependencies { …
John Reese
  • 583
  • 2
  • 6
  • 17
13
votes
2 answers

Flyway multiple metadata tables in one schema

I'm trying to use Flyway to version the database of a modular application. Each module has its own separate set of tables, and migration scripts that will control the versioning of that set of tables. Flyway allows me to specify a different metadata…
Daniel
  • 383
  • 3
  • 13
13
votes
2 answers

Spring MVC - Cleaning the database between tests using Flyway

I use Flyway to manage the state of my DB in my Spring MVC application. I have it configured in my servlet context XML file exactly as the recommend in their docs
user2490003
  • 10,706
  • 17
  • 79
  • 155
13
votes
1 answer

Flyway migration hangs for postgres CREATE INDEX CONCURRENTLY

I am trying to run a CREATE INDEX CONCURRENTLY command against a Postgres 9.2 database. I implemented a MigrationResolver as shown in issue 655. When this migration step is run via mvn flyway:migrate or similar, the command starts but hangs in…
CPhelps
  • 279
  • 1
  • 3
  • 7
13
votes
2 answers

How does flyway sort version numbers?

If we have migrations like: V1_6__six.sql V1_7__seven.sql V1_8__eight.sql V1_9__nine.sql What should we use for the next version? If we use V1_10 will that come after V1__9? Or would we need to prefix the single digit version numbers with a 0?…
Marplesoft
  • 6,030
  • 4
  • 38
  • 46
13
votes
1 answer

How to get flyway to re-run migration?

OUR SYSTEM We are trying to put migrations as .sql files under version control. Developers would write a VN__*.sql file, commit to version control and a job that runs every 5 minutes would automatically migrate to a Dev and Test database. Once the…
Bob Mac
  • 151
  • 2
  • 2
  • 6
12
votes
1 answer

Flyway out of order migration

Imagine I have the following flyway migrations: V1__create_table.sql V2__create_table.sql V4__create_table.sql And these migrations have been applied to my database. Is there a possibility to add the following script: V3__create_table.sql And…
Titulum
  • 9,928
  • 11
  • 41
  • 79
12
votes
8 answers

Flyway can't find classpath:db/migrations

I just started right now a new project in Intellij using Spring Boot ver 2.1.3 and Flyway 5.2.4 with Java 11. After try to start my project i got : Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name…
Ronaldo Lanhellas
  • 2,975
  • 5
  • 46
  • 92
12
votes
2 answers

Delete migration in flyway

I'm experiencing the following issue: org.flywaydb.core.api.FlywayException: Validate failed: Detected applied migration not resolved locally: 1.44 That happened when I understood that the data that I added in 1.44 is invalid and I don't want to…
dvelopp
  • 4,095
  • 3
  • 31
  • 57