diff --git a/flyway-database-yugabytedb/src/main/java/org/flywaydb/community/database/postgresql/yugabytedb/YugabyteDBDatabase.java b/flyway-database-yugabytedb/src/main/java/org/flywaydb/community/database/postgresql/yugabytedb/YugabyteDBDatabase.java index 663871e..7d0c1bb 100644 --- a/flyway-database-yugabytedb/src/main/java/org/flywaydb/community/database/postgresql/yugabytedb/YugabyteDBDatabase.java +++ b/flyway-database-yugabytedb/src/main/java/org/flywaydb/community/database/postgresql/yugabytedb/YugabyteDBDatabase.java @@ -38,7 +38,8 @@ public class YugabyteDBDatabase extends PostgreSQLDatabase { public static final String LOCK_TABLE_NAME = "YB_FLYWAY_LOCK_TABLE"; // Using table name in lower case, see https://github.com/flyway/flyway-community-db-support/issues/97 - private static final String LOCK_TABLE_SCHEMA_SQL = "SELECT table_name, column_name FROM information_schema.columns WHERE table_name = '" + LOCK_TABLE_NAME.toLowerCase() + "'"; + // Filter by current schema to support multi-schema migrations + private static final String LOCK_TABLE_SCHEMA_SQL = "SELECT table_name, column_name FROM information_schema.columns WHERE table_name = '" + LOCK_TABLE_NAME.toLowerCase() + "' AND table_schema = current_schema()"; private static final String DROP_LOCK_TABLE_IF_EXISTS_DDL = "DROP TABLE IF EXISTS " + LOCK_TABLE_NAME; /** * This table is used to enforce locking through SELECT ... FOR UPDATE on a