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

tecklund opened this issue Apr 19, 2015 · 4 comments

Error setting current schema to "public" #995

tecklund opened this issue Apr 19, 2015 · 4 comments


Copy link

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

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.

Copy link

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.

Copy link

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

axelfontaine pushed a commit to flyway/ that referenced this issue Oct 28, 2015
Copy link

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
Copy link

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);
        // 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");
        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
None yet

No branches or pull requests

3 participants