Search code examples
javaflyway

Flyway throwing error on migration script


I'm trying out Flyway to potentially use in our project and so I have an extremely simple migration script. I appear to have set something up incorrectly however - flyway connects to my DB (SQL Server 2008 R2) successfully to create metadata tables, but when I run the script I get

 [ERROR] Failed to execute goal com.googlecode.flyway:flyway-maven-plugin:2.2.1:migrate      (default-cli) on project persistence: com.googlecode.flyway.cor
 e.api.FlywayException: Migration of schema [dbo] to version 1.1 failed! Changes successfully rolled back. Incorrect syntax near '?'. -> [Help 1]

My script is:

 ALTER TABLE msg.Message
 ADD Deleted bit NULL

Looking at the debug logs, flyway outputs:

 [DEBUG] Executing SQL: ??A L T E R   T A B L E   m s g . M e s s a g e

  A D D   D e l e t e d   b i t   N U L L

I don't know where the question marks come from, or why the text has spaces. Any ideas?


Solution

  • That kind of output indicates UTF, but in the 16-bit form, with a magic character at the beginning. The ? and spaces are the giveaway.

    Several MS tools speak that natively, while most Unix tools use UTF-8.