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
19
votes
7 answers

FlywayException: Unable to scan for SQL migrations in location: classpath:db/migration

I'm trying to start using flyway with maven integration but can't make it work. I'm following the documentation seems to be very simple so no strange things seem to be done. My pom.xml is the following:
Federico Piazza
  • 30,085
  • 15
  • 87
  • 123
18
votes
2 answers

What is the last version of flyway community edition that supported MySQL 5.7

I have been using flyway community edition version 5.2.3 for a while now. We just recently tried to upgrade flyway to version 8.2. After upgrading to version 8.2 the execution against MySQL 5.7 is throwing an error stating "ERROR: Flyway Teams…
corey
  • 181
  • 1
  • 1
  • 3
18
votes
2 answers

ClassNotFoundException: org.flywaydb.core.api.callback.FlywayCallback

When trying to start a Spring Boot application with mvn spring-boot:run I get this error: Caused by: java.lang.ClassNotFoundException: org.flywaydb.core.api.callback.FlywayCallback Indeed that class doesn't exist, but…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
18
votes
5 answers

Can Flyway or Liquibase generate an update script instead of updating the database directly?

First, a little background. I have a set of Java applications, some based on JPA, some not. To create my databases I am currently using Hibernates schema export to generate create scripts for those using JPA. Those not using JPA I generate the…
pillingworth
  • 3,238
  • 2
  • 24
  • 49
17
votes
2 answers

Migrating Stored Procedures with Flyway

How should procedural database code like stored procedures be managed with a database migration tool like Flyway? Unlike DDL I would not want to see changes to a stored procedure stored within multiple database migration files. How can procedural…
Nick Allen
  • 1,443
  • 1
  • 11
  • 29
16
votes
5 answers

Setup h2 in spring boot application with r2dbc and flyway

I'm playing around with Spring Boot and the reactive jdbc driver called r2dbc. In my main application I'm using Postgres as a database and now I want to the use h2 for the tests. And the Flyway migration is working with the setup but when the Spring…
imalik8088
  • 1,501
  • 5
  • 21
  • 39
16
votes
1 answer

Setting up multiple database with Flyway

I am trying to setup two different database with Flyway 5.0.7, MySQL for development and H2 for testing. I have configured both databases in respective files. For Development,…
Meena Chaudhary
  • 9,909
  • 16
  • 60
  • 94
16
votes
2 answers

Spring boot and Flyway: Clear database data before integration tests

I'm building a REST service using Spring boot framework (v2.0.2), where I have integration tests running on a database. I googled a lot and there is a sea of articles about cleaning database before tests, but unfortunately I find them either…
Samurai Girl
  • 978
  • 2
  • 8
  • 13
16
votes
4 answers

Spring beans are not injected in flyway java based migration

I'm trying to inject component of configuration properties in the flyway migration java code but it always null. I'm using spring boot with Flyway. @Component @ConfigurationProperties(prefix = "code") public class CodesProp { private String…
NHS
  • 195
  • 1
  • 2
  • 13
16
votes
3 answers

Flyway - Migrate to specific version

Is there a way to tell flyway to migrate only to specific version? For e.g. I have 4 versions e.g. V1, V2, V3and V4 scripts and I want to migrate only to V3 but not to v4.
CrazyCoder
  • 2,465
  • 8
  • 36
  • 57
16
votes
3 answers

Flyway migration, Unable to obtain Jdbc connection from DataSource

I am trying to use flyway to create and manage a MySQL database. Here is the code i have got so far. FlywayMigration.java : Class that applys the migration public class FlywayMigration { public FlywayMigration(DatabaseConfiguration…
TurboNerd
  • 181
  • 1
  • 2
  • 7
16
votes
4 answers

How do I create indexes concurrently with flyway in postgres?

Postgres allows the creation of indexes without locking the table using the CONCURRENTLY option. This options is not allowed in a transaction, so when it is added to a flyway migration script flyway fails: ERROR: Caused by…
Anthony Galea
  • 310
  • 1
  • 3
  • 9
15
votes
4 answers

How do placeholders work in Flyway?

I'm evaluating Flyway for use in my project. Our current SQL scripts contain placeholders for things like URLs which will have a different domain names depending on the environment (dev, qa, prod). Specifically, we might have INSERT statements…
gangsta
  • 837
  • 2
  • 7
  • 10
15
votes
6 answers

How to run flyway migration for reactive r2dbc driver on sprintboot stratup

I am working on springboot webflux project with non-blocking database driver r2dbc, But when Springboot application start Flyway does not run migrations. Below are my spring-boot pom.xml
Alpesh Jikadra
  • 1,692
  • 3
  • 18
  • 38
15
votes
1 answer

How to use Flyway configuration to handle multiple databases

we have a java application configured with maven that uses multiple databases. It is one app - many schemas. I've configured flyway, tested and it works well but my config is only for one database. Here is my pom.xml tested with one schema:
Federico Piazza
  • 30,085
  • 15
  • 87
  • 123