{{ !articles[0].partner.isSponsoringArticle ? "Platinum" : "Portal" }} Partner

Flyway 2.1 released with automatic schema creation

Flyway 2.1 is out!

Highlights of this release:

  • Automatic Schema Creation
  • SQL migrations from Filesystem (instead of only from classpath)
  • Command-line tool shared installation (freely configurable SQL and JAR folders)

Automatic Schema Creation

Flyway has always made it easy to get started. Simply point it at an empty schema and of you go. And now it just got even better. Flyway has gained the ability to automatically create (and drop) schemas.

How does it work? In Flyway-style, fully automatic and transparent for the user:

Flyway flyway = new Flyway();
flyway.setSchemas(“NEW_SCHEMA_1”, “NEW_SCHEMA_2”);

And voilà! If the schemas already exist, Flyway uses them, otherwise Flyway creates them. Running this against and empty DB will produce this:

SQL migrations from Filesystem (instead of only from classpath)

The most efficient way to make sure your database and code never get out of sync is to run database migrations on application startup. There are however a number of scenarios where this is not easily feasible, and this is why the Maven plugin, the Ant tasks and the Command-line tool were created. In order to better serve these environments (and the users of the API for whom it is not practical to ship the migrations on the classpath), Flyway 2.1 now introduces support for loading SQL migrations directly from the filesystem. All you have to do, is prefix a location with filesystem: and you’re good to go:

Flyway flyway = new Flyway(); flyway.setDataSource(…); flyway.setLocations(“filesystem:/path/to/migrations”); flyway.migrate();

Command-line tool shared installation (freely configurable SQL and JAR folders)

The Command-line tool has made it easy to get started for users in a scripting environment or without a Maven or Ant installation available. So far, however, you could only place JDBC drivers and migrations within its own installation path. This made sharing a single installation of the tool amongst projects harder that it should be. These restrictions have now been lifted. You can have a single installation and point to project-specific drivers and migrations like this:

flyway.sh migrate –locations=filesystem:/path/to/migrations –jarDir=/path/to/jdbc/drivers

In addition to these three new features, this releases packs numerous bug fixes and small improvements. All of which wouldn’t have been possible without the tireless work of all the ones who contributed issue reports and submitted fixes and pull requests. Thank you!

So go ahead, and grab Flyway 2.1 while it’s hot: flywaydb.org


P.S.: This release also marks the move to GitHub: github.com/flyway/flyway. Check it out and keep the pull requests coming!

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks