Flyway hangs when creating and bootstrapping a database

I would like to use Flyway for schema migration management, but have hit an issue using it with Cockroach. If I have the jdbc url connect to the defaulted, and have the managed schema listed under flyway.schema, when performing a baseline (or migrate), Flyway will check for the existence of the database, create it if it does not exist, and then create and populate its schema versioning table.

Using the above configuration setup, whereby Flyway would need to create the database (in a new deployment for example), the transaction hangs indefinitely. Now, if I change the config so I must assume that the managed database already exists, and have it contained in the jdbc url, then Flyway can create the versioning table and the rest of the managed schema tables just fine.

I’m testing this on version 2.1, and have also tried on version 19.1.

I noticed some previous bugs in GitHub (e.g., however these have been closed.

Is this still a bug? If not should I raise a bug on GitHub?

Hey @mark_balmer

Typically, we have recommended separating schema changes into separate files as a workaround. This will enable Flyway to work, so in your case separating the “create if it does not exist” and the “create and populate” should be separated.

The issue referenced above had a fix that was committed and is part of the 19.1.5 release. The PR was specifically for the issue where Flyway attempts to update a column in the same transaction as it was added. This would cause the issue with the job to go pending.

We are continually working to improve integrations with Flyway, so please stay tuned and keep an eye on further release notes in the near future.