Question

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?

Was it helpful?

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.

OTHER TIPS

Changing the encoding of the sql migration file to UTF-8 solved the '??' error for me.

Changing the encoding for the file worked for me. I used a text editor (Notepad++):

  1. Open the file in the text editor.
  2. Select 'Encoding' in the menu.
  3. Choose the encoding type from the list of options.
  4. Save the file.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top