Reputation: 5142
I am in the process of upgrading from gradle 4 to 6. This forced me to upgrade many stuff like spring, h2, mySql connector, etc..
Now I have this problem: on runtime, using MySQL all works fine. but on tests, I get:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flyway' defined in com.bluerbn.wallet.infra.SpringTestConfiguration: Invocation of init method failed; nested exception is org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException:
Migration V9__fixIndex.sql failed
------------------------------------------------
SQL State : 42S22
Error Code : 42122
Message : Column "INDEX" not found; SQL statement:
ALTER TABLE table1 DROP INDEX ACC_INDEX [42122-200]
Location : db/migration/V9__fixIndex.sql (/Users/.../resources/db/migration/V9__fixIndex.sql)
Line : 1
Statement : ALTER TABLE table1 DROP INDEX ACC_INDEX
This is an old script that was working fine before the upgrade.
versions:
Any ideas?
Upvotes: 0
Views: 375
Reputation: 8188
H2 since the version 1.4.200 allows MySQL-style ALTER TABLE tableName DROP INDEX indexName
only in MySQL compatibility mode. In 1.4.199 and older versions this invalid (for H2) command was incorrectly accepted in all modes.
You need to append ;MODE=MySQL
to JDBC URL for H2.
Upvotes: 2