diff --git a/pom.xml b/pom.xml
index f2f64fa2f..764c2b2e5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -135,7 +135,7 @@
io.ebean
ebean-migration
- 11.8.1
+ 11.8.2
diff --git a/src/main/java/io/ebean/config/DbMigrationConfig.java b/src/main/java/io/ebean/config/DbMigrationConfig.java
index f40f6f58d..d09f3430a 100644
--- a/src/main/java/io/ebean/config/DbMigrationConfig.java
+++ b/src/main/java/io/ebean/config/DbMigrationConfig.java
@@ -107,6 +107,11 @@ public class DbMigrationConfig {
*/
protected String dbSchema;
+ /**
+ * Set to true if we consider this the 'default schema' (Postgres schema that matches DB username)
+ */
+ protected boolean defaultDbSchema;
+
/**
* DB user used to run the DB migration.
*/
@@ -400,9 +405,15 @@ public class DbMigrationConfig {
* Set the Db schema if it hasn't already been defined.
*/
public void setDefaultDbSchema(String dbSchema) {
- if (this.dbSchema == null) {
- this.dbSchema = dbSchema;
- }
+ this.defaultDbSchema = true;
+ this.dbSchema = dbSchema;
+ }
+
+ /**
+ * Return true if this is considered the default DB schema (Postgres schema matching DB username).
+ */
+ public boolean isDefaultDbSchema() {
+ return defaultDbSchema;
}
/**
@@ -591,6 +602,9 @@ public class DbMigrationConfig {
runnerConfig.setDbUsername(getDbUsername());
runnerConfig.setDbPassword(getDbPassword());
runnerConfig.setDbSchema(getDbSchema());
+ if (defaultDbSchema) {
+ runnerConfig.setSetCurrentSchema(false);
+ }
runnerConfig.setClassLoader(classLoader);
if (patchInsertOn != null) {
runnerConfig.setPatchInsertOn(patchInsertOn);