flyway-9.21.2 updates CURRENT_SCHEMA in Db2
Lennart
Posts: 3 New member
I upgraded to flyway-9.21.2 and a migration that replaces an external function written in Java fails because db2 can not locate the jar file for the implementation. This works in 8.4.1 and I think I isolated the error down to that CURRENT_SCHEMA is different. Created a dummy migration like:
VALUES CURRENT_SCHEMA;
and when I run in 8.4.1, I get:
#> flyway-8.4.1 -defaultSchema=NYA_FLYWAY -schemas=DB2INST1,NYA_FLYWAY -table=FLYWAY_SCHEMA_HISTORY -driver=com.ibm.db2.jcc.DB2Driver -url=jdbc:db2://nya-01:50000/nya -user=db2inst1 -password=${passwd} -jarDirs=/home/lejo0004/. -locations="filesystem:/home/lejo0004/Project/db-legacy/nya/src/main/resources/db/migration" migrate
VALUES CURRENT_SCHEMA;
deliberate cause error
and when I run in 8.4.1, I get:
#> flyway-8.4.1 -defaultSchema=NYA_FLYWAY -schemas=DB2INST1,NYA_FLYWAY -table=FLYWAY_SCHEMA_HISTORY -driver=com.ibm.db2.jcc.DB2Driver -url=jdbc:db2://nya-01:50000/nya -user=db2inst1 -password=${passwd} -jarDirs=/home/lejo0004/. -locations="filesystem:/home/lejo0004/Project/db-legacy/nya/src/main/resources/db/migration" migrate
+----------+
| 1 |
+----------+
| DB2INST1 |
+----------+
...
#> flyway-9.21.2 -defaultSchema=NYA_FLYWAY -schemas=DB2INST1,NYA_FLYWAY -table=FLYWAY_SCHEMA_HISTORY -driver=com.ibm.db2.jcc.DB2Driver -url=jdbc:db2://nya-01:50000/nya -user=db2inst1 -password=${passwd} -jarDirs=/home/lejo0004/. -locations="filesystem:/home/lejo0004/Project/db-legacy/nya/src/main/resources/db/migration" migrate
+------------+
| 1 |
+------------+
| NYA_FLYWAY |
+------------+
...
Is this deliberate and is there a way to declare the schema for the history table without affecting registers for the user running the migration?
Is this deliberate and is there a way to declare the schema for the history table without affecting registers for the user running the migration?
Tagged:
Answers
Hi @Lennart
Thank you for reaching out on the Redgate forums regarding your Flyway schema question.
I found this page, which might be relevant to your question, it is around the defining of schema for the history table.
https://documentation.red-gate.com/fd/table-184127544.html
By default, in single-schema mode, the schema history table is placed in the default schema for the connection provided by the datasource.
When the defaultSchema or schemas property is set, in multi-schema mode, the schema history table is placed in the specified default schema.