Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MetaDataTable not updated with autoCommit false #1534

fabian opened this issue Feb 17, 2017 · 2 comments

MetaDataTable not updated with autoCommit false #1534

fabian opened this issue Feb 17, 2017 · 2 comments


Copy link

fabian commented Feb 17, 2017

This seems to affect Flyway 4.1 and later. So far we've been using Flyway 3 where this wasn't an issue.

If the DataSource used for Flyway has autoCommit=false, the meta data table schema_version is not updated after a migration has been executed.

I've searched around in the source code and I suspect the bug has probably been introduced with #851 when the TransactionTemplate was replaced with a metaDataTable lock:


Before this commit, applying the migration and updating the meta data table (applyMigration) were wrapped in one transaction which made sure the meta data table changes got committed.

Maybe a TransactionTemplate should be added in MetaDataTableImpl.addAppliedMigration?

Copy link

axelfontaine commented Feb 17, 2017

Note for future issues: please use the template we provided as it avoids the need to ask the following questions.

Which database + version are you using?

Can you share a small test case that reproduces the issue?

Copy link

fabian commented Feb 17, 2017

I skipped the template because it seemed mostly irrelevant. I've filled it now out below. I have now also created some test code showing the issue:

What version of Flyway are you using?


Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin, SBT plugin, ANT tasks)

Java API

What database are you using (type & version)?

MySQL 5.7.17

What operating system are you using?

macOS 10.12.3

What did you do?

(Please include the content causing the issue, any relevant configuration settings, and the command you ran)

HikariDataSource dataSource = new HikariDataSource();

Flyway flyway = new Flyway();
What did you expect to see?

Migration in schema_version table.

What did you see instead?

Empty schema_version table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants