5

I'm running this command

 docker run --network=foo --rm -v C:/Users/xxxx/Documents/flyway/sql:/flyway/sql flyway/flyway migrate -user=sa -password=MyPassword001 -url="jdbc:sqlserver://sqlserver-test:1433;databaseName=master"

And I've got this error.

Flyway Community Edition 6.0.1 by Boxfuse
Database: jdbc:sqlserver://sqlserver-test:1433;useBulkCopyForBatchInsert=false;cancelQueryTimeout=-1;sslProtocol=TLS;jaasConfigurationName=SQLJDBCDriver;statementPoolingCacheSize=0;serverPreparedStatementDiscardThreshold=10;enablePrepareOnFirstPreparedStatementCall=false;fips=false;socketTimeout=0;authentication=NotSpecified;authenticationScheme=nativeAuthentication;xopenStates=false;sendTimeAsDatetime=true;trustStoreType=JKS;trustServerCertificate=false;TransparentNetworkIPResolution=true;serverNameAsACE=false;sendStringParametersAsUnicode=true;selectMethod=direct;responseBuffering=adaptive;queryTimeout=-1;packetSize=8000;multiSubnetFailover=false;loginTimeout=15;lockTimeout=-1;lastUpdateCount=true;encrypt=false;disableStatementPooling=true;databaseName=master;columnEncryptionSetting=Disabled;applicationName=Microsoft JDBC Driver for SQL Server;applicationIntent=readwrite; (Microsoft SQL Server 14.0)
ERROR: Unable to calculate checksum for V1.1__My_description.sql: Input length = 1

The file's content is very simple. I create a table.

I'm using Flyway Community Edition 6.0.1 by Boxfuse

giraffe
  • 165
  • 3
Vicente
  • 166
  • 1
  • 9

3 Answers3

8

In my case I had to change the sql file encoding from ANSI to UTF-8 to avoid this error.

I did this by opening the sql file in Notepad++. After clicking "Convert to UTF-8" from the "Encoding" menu I saved the file and reran the flyway command with success.

giraffe
  • 165
  • 3
4

I found the solution, The problem was in the line endings. My file had inconsistent Line endings. some lines ends with \r\n and another ending with \r or \n. This hapend because I generated a sql script since SQL Management Studio. normalize inconsistent line endings The solution was in SQL Management Studio too. enter image description here

Vicente
  • 166
  • 1
  • 9
0

I was also facing the same issue. I just created a normal text file. opened it in notepad and pasted the whole SQL script. enter image description here

then renamed it to SQL file (ex: filename.sql) After that, I tried to run it through the flyway and it worked.

Arif khan
  • 41
  • 9