2018-10-04 by Axel Fontaine
After a summer of hard work we are happy to release the next major update in the Flyway 5.x series, Flyway 5.2.0. It comes with many of new features and improvements.
These are the highlights of this release:
Let’s dive right in!
The Java platform keeps on moving forward and has now arrived at an important milestone: Java 11. The release marks both the introduction of the new commercial Oracle LTS release model with one LTS release every 3 years as well as the fact that feature parity has now been achieved at last between OpenJDK and the Oracle JDK. Starting with this release both the Oracle JRE and the OpenJDK JRE are now fully supported by Flyway.
Five years after the initial release of Oracle 12, we now have a brand new Oracle major release: 18c. It was initially available exclusively for Oracle Cloud. And now since August 2018 it is also available for download and Flyway 5.2.0 comes with full support for it.
MariaDB is also constantly moving forward. Version 10.3 is now out with additional features not found in MySQL.
Starting with 5.2.0, all editions of Flyway now officially supports this release as well.
On the MySQL side, Flyway now also fully supports Percona XtraDB Cluster 5.7.
And finally on the database front, Flyway 5.2.0 now also fully supports both Amazon Aurora MySQL and Amazon Aurora PostgreSQL in all versions of the respective engines.
Flyway 5.1.0 introduced a new fluent configuration style for the Flyway API. This new style has now become the new default. Configuring Flyway can now be done with just a single statement:
Flyway flyway = Flyway.configure().dataSource(url, user, password).load(); flyway.migrate();
And this can be made even more concise if you only want to invoke a single operation:
Flyway.configure().dataSource(url, user, password).load().migrate();
This marks an important step in the transition to making the Flyway object itself immutable, which will enable further optimizations from Flyway 6.0 onwards.
Many Docker images for databases on Docker Hub unfortunately do not support Docker’s very useful
and there doesn’t appear to be a solution in sight.
This particularly complicates things when used in conjunction with Flyway in a Docker Compose setup where all containers are started at the same time, as this almost unanimously results in the Flyway container coming up before the database is ready and then failing to connect.
While workarounds such as adding an extra sleep to the Flyway container’s command do work, they aren’t satisfactory as the sleep will either be too short and things will fail, or the sleep will be too long and it will needlessly delay things.
To remedy this Flyway 5.2.0 now comes with a new
connectRetries property which instructs Flyway to reattempt failed
connections up to this many times at 1 second intervals. This together now enables the following nice
version: '3' services: flyway: image: boxfuse/flyway command: -url=jdbc:mysql://db -user=root [email protected] -connectRetries=300 migrate volumes: - .:/flyway/sql depends_on: - db db: image: mysql environment: - [email protected] command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci ports: - 3306:3306
docker-compose up will pull both images, start both containers and Flyway will wait up to 300 seconds for
MySQL to become available. As soon as it is and Flyway will connect to it and perform the migration.
Starting with Flyway 5.2.0 the command-line distribution comes bundled with all editions of Flyway. By default the
community edition is active. To launch any of the other editions set the
FLYWAY_EDITION environment variable to
enterprise. These 3 also require the new
licenseKey parameter to be set to
accept the Flyway Trial Edition license and start a 30 trial or to your actual license key
for Flyway Pro and Enterprise Edition.
This in turn means that the Flyway Docker image now also comes with all edition of Flyway, making it easier for Flyway Pro and Enterprise Edition customers to use Flyway directly from Docker Hub.
Flyway 5.2.0 continues to expand Flyway’s SQL*Plus command support. This release now adds support for the following additional commands:
With this Flyway now automatically handles SQL*Plus
@other_script.sql external script references. These acripts are
automatically discovered using the configured Flyway locations and they are executed within the same transaction as the
main migration. Their checksum is also taken into account when calculating the overall checksum of the migration.
Additionally passing arguments is also fully supported and they will be mapped as expected to the numbered SQL*Plus
All this is just the tip of the iceberg. With almost 50 issues fixed and features implemented, this release packs tons of small improvements and polish across the board. So make sure to check out the release notes.
Enjoy Flyway 5.2.0 and grab it while it’s hot!
It is the fastest, most complete and most reliable Flyway release so far. All users are encouraged to upgrade.
Now it’s your turn! Spread the word, follow @flywaydb on Twitter and subscribe to our newsletter below to be the first one to be notified about updates.