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

Support backtick as an identifier quote for H2 database running in MySql mode #2511

Closed
elieabichar-wk opened this issue Sep 23, 2019 · 2 comments
Closed

Comments

@elieabichar-wk
Copy link

@elieabichar-wk elieabichar-wk commented Sep 23, 2019

Which version and edition of Flyway are you using?

6.0.4

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

Java API

Which database are you using (type & version)?

H2 with mysql compatibility mode

Which operating system are you using?

Mac OS

What did you do?

When updating Flyway from 5.2.4 to 6.0.4 we started hitting an unknow character exception due to backtick usage as an identifier quote in .sql files.

It looks like the recently introduced H2Parser does not support a backtick as an IdentifierQuote but should mimic MySqlParser for H2 with MySql compatibility.

Exception

org.flywaydb.core.api.FlywayException: Unable to parse statement in db/migration/V1__initial_version.sql at line 43 col 1: Unknown char ` encountered on line 43 at column 28
at org.flywaydb.core.internal.parser.Parser.getNextStatement(Parser.java:284)
at org.flywaydb.core.internal.parser.Parser.access$000(Parser.java:44)
at org.flywaydb.core.internal.parser.Parser$ParserSqlStatementIterator.next(Parser.java:649)
at org.flywaydb.core.internal.parser.Parser$ParserSqlStatementIterator.next(Parser.java:614)
at org.flywaydb.core.internal.sqlscript.ParserSqlScript.parse(ParserSqlScript.java:79)
at org.flywaydb.core.internal.sqlscript.ParserSqlScript.validate(ParserSqlScript.java:124)
at org.flywaydb.core.internal.sqlscript.ParserSqlScript.executeInTransaction(ParserSqlScript.java:187)
at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.canExecuteInTransaction(SqlMigrationExecutor.java:75)
at org.flywaydb.core.internal.command.DbMigrate.isExecuteGroupInTransaction(DbMigrate.java:312)
at org.flywaydb.core.internal.command.DbMigrate.applyMigrations(DbMigrate.java:275)
at org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:244)
at org.flywaydb.core.internal.command.DbMigrate.access$100(DbMigrate.java:54)
at org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:162)
at org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:159)
at org.flywaydb.core.internal.database.base.Connection$1.call(Connection.java:131)
at org.flywaydb.core.internal.jdbc.TransactionTemplate.execute(TransactionTemplate.java:74)
at org.flywaydb.core.internal.database.base.Connection.lock(Connection.java:127)
at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:139)
at org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:159)
at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:137)
at org.flywaydb.core.Flyway$1.execute(Flyway.java:183)
at org.flywaydb.core.Flyway$1.execute(Flyway.java:143)
at org.flywaydb.core.Flyway.execute(Flyway.java:507)
at org.flywaydb.core.Flyway.migrate(Flyway.java:143)```
What did you expect to see?

Migration to pass as it used to in 5.2.4

What did you see instead?

provided stacktrace

@juliahayward

This comment has been minimized.

Copy link
Member

@juliahayward juliahayward commented Sep 24, 2019

Would you be able to supply a sample script that we can test with, please?

@juliahayward juliahayward added this to the Flyway 6.0.5 milestone Sep 24, 2019
@elieabichar-wk

This comment has been minimized.

Copy link
Author

@elieabichar-wk elieabichar-wk commented Sep 24, 2019

The sql script below works on 5.2.4 with H2 running in MySql mode enabled since Mysql supports backtick but is broken in flyway 6.0.4

CREATE TABLE `test` (`test` INT);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.