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
Validation fails on migrate when schema doesn't exist #1331
Comments
This works for me. Please reopen with an exact series of steps to reproduce this or a pull request (including a test) if this happens again. |
I can (must) confirm the issue. It arises with an completely empty database, due to some chicken/egg problem: a) Completely empty means, in particular, that my schema (SA) does not exist.
in DerbyDbSupport.doChangeCurrentSchemaTo. That fails, of course, because the schema does not I am unsure, how to handle this situation. Nevertheless, it exists: (See the following stacktrace.)
|
@jochenw Could you attach a sample test case? |
I believe, that you can repropduce this problem by changing the database user and password from "", "" to "sa", "sa" in the Derby related tests. |
I can reproduce the problem with this simple test case:
|
I'm having the same issue with Derby 10.13.1.1. In Flyway 3.2.1 it works fine. |
What version of Flyway are you using?
4.0.1
What database are you using (type & version)?
Derby 10.10.2.0
What operating system are you using?
CentOS 7
What did you do?
Run flyway migrate on a new database which doesn't have initial schema.
Flyway flyway = new Flyway();
...
flyway.setValidateOnMigrate(true);
flyway.migrate();
What did you expect to see?
I expected that new schema will be created and then all other migration tasks will be executed.
And it works so in v3.2.1
What did you see instead?
Exception happens on validation step and as a result migration doesn't continue:
Caused by: org.flywaydb.core.api.FlywayException: Error restoring current schema to its original setting
at org.flywaydb.core.internal.dbsupport.DbSupport.restoreCurrentSchema(DbSupport.java:132)
at org.flywaydb.core.internal.command.DbValidate.validate(DbValidate.java:191)
at org.flywaydb.core.Flyway.doValidate(Flyway.java:994)
at org.flywaydb.core.Flyway.access$100(Flyway.java:72)
at org.flywaydb.core.Flyway$1.execute(Flyway.java:921)
at org.flywaydb.core.Flyway$1.execute(Flyway.java:917)
at org.flywaydb.core.Flyway.execute(Flyway.java:1365)
at org.flywaydb.core.Flyway.migrate(Flyway.java:917)
Workaround is to switch off validateOnMigrate but it is not convenient for general solution.
The text was updated successfully, but these errors were encountered: