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

No schema history found in dry run #2770

Closed
pyranja opened this issue Apr 14, 2020 · 0 comments
Closed

No schema history found in dry run #2770

pyranja opened this issue Apr 14, 2020 · 0 comments
Assignees
Milestone

Comments

@pyranja
Copy link

pyranja commented Apr 14, 2020

Which version and edition of Flyway are you using?

Flyway Pro v6.3.3

If this is not the latest version, can you reproduce the issue with the latest one as well?

(Many bugs are fixed in newer releases and upgrading will often resolve the issue)

We hit this bug when trying to upgrade from v6.0.8

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

Java API. We are bundling sql migrations and flyway into a small java wrapper app, that is run as a docker image. The java wrapper either executes migrations or performs a dry run based on environment variables.
This issue can be reproduced in an IDE - I'm confident that it is not related to the wrapper app or docker environment.

Which database are you using (type & version)?

Postgres 11 & AWS Aurora Postgres 11

Which operating system are you using?

Amazon Linux 2, Ubuntu

What did you do?

(Please include the content causing the issue, any relevant configuration settings, the SQL statement that failed (if relevant) and the command you ran.)

  • execute flyway to apply migrations to a new postgres docker instance.
  • execute a flyway dry run on the same postgres instance (no migrations should be needed)
What did you expect to see?

Dry run output should only show repeatable migrations and report that the schema version is up to date.

What did you see instead?

Dry run output reports that all migrations would be run and that the schema is empty

{"msg":"Current version of schema \"exchange\": << Empty Schema >>","srv":"xchg-persistence-migrations","ts":"2020-04-14T19:58:23.747Z","level":"INFO","logger":"org.flywaydb.core.internal.command.DbMigrat
e","thread":"vert.x-worker-thread-0"}

Debugging

I debugged and identified a likely cause:
When doing a dry run, DryRunJdbcProxies are injected that intercept query executions and return empty dummy results.
These also intercept the query that is used by JdbcTableSchemaHistory#refreshCache to load applied migrations.
Therefore the schema history is empty when executing a dry run.

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

No branches or pull requests

2 participants