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

Error setting current schema to "public" #995

Closed
tecklund opened this issue Apr 19, 2015 · 4 comments
Closed

Error setting current schema to "public" #995

tecklund opened this issue Apr 19, 2015 · 4 comments
Milestone

Comments

@tecklund
Copy link

@tecklund tecklund commented Apr 19, 2015

With the following settings in flyway-gradle-plugin version 3.2.1

flyway{
url = "jdbc:h2:mem;MODE=MySQL"
user = "sa"
schemas = ["PUBLIC"]
}
I get the following error: Error setting current schema to "public"

What was strange about this error was when I turned on debug I could see the PUBLIC schema get populated with the schema_version table and the migrations ran without error. The plugin reported the error after running almost to completion.

Tacking INIT=CREATE SCHEMA IF NOT EXISTS "public" to the end of the url worked as a work around.

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Apr 20, 2015

There are still some issues with h2 and the various db compatibility modes. In the future we want to provide the possibility to override the db autodetection with a specific db type, which would most likely fix this.

@tecklund
Copy link
Author

@tecklund tecklund commented Apr 20, 2015

Thanks for getting back to me, I look forward to the fix!

axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Oct 28, 2015
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Oct 28, 2015

This was fixed as part of changes on how we read and set the current schema.

@axelfontaine axelfontaine added this to the Flyway 4.0 milestone Oct 28, 2015
@hieuduy
Copy link

@hieuduy hieuduy commented Dec 9, 2016

Hi @axelfontaine,

Using on H2 DB, my application is running through all migration scripts successfully.
But I'm still experiencing in this issue. here below is my snippet code:

        Flyway flyway = new Flyway();
        flyway.setDataSource(String.format("jdbc:h2:%s;IFEXISTS=TRUE;MODE=MySQL;FILE_LOCK=NO", dbLocation), "sa", null);
        flyway.setSchemas("main");
        flyway.repair();
        flyway.migrate();
        // After the migration was completed then try setting back the particular schemas
        // to avoid the exception but it's still there
        flyway.setSchemas("public", "PUBLIC");
        flyway.baseline(); 
        org.flywaydb.core.api.FlywayException: Error setting current schema to "public"

The current version:

  • H2 DB: 1.4.193 (Embedded)
  • Flyway: 4.0.3

I'm appreciated in your help.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.