Search code examples
sql-serverdockerflyway

Flyway Error - When I run migrate command. I get "Unable to calculate checksum"


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


Solution

  • 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