【问题标题】:Flyway Error - When I run migrate command. I get "Unable to calculate checksum"Flyway 错误 - 当我运行 migrate 命令时。我得到“无法计算校验和”
【发布时间】:2020-01-09 11:42:33
【问题描述】:

我正在运行这个命令

 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"

我遇到了这个错误。

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

文件的内容很简单。我创建了一个表。

我正在使用 Boxfuse 的 Flyway 社区版 6.0.1

【问题讨论】:

    标签: sql-server docker flyway


    【解决方案1】:

    就我而言,我必须将 sql 文件编码从 ANSI 更改为 UTF-8 以避免此错误。

    我通过在 Notepad++ 中打开 sql 文件来做到这一点。从“编码”菜单中单击“转换为 UTF-8”后,我保存了文件并成功重新运行了 flyway 命令。

    【讨论】:

      【解决方案2】:

      我找到了解决方案,问题出在行尾。我的文件的行结尾不一致。有些行以\r\n 结尾,另一行以\r\n 结尾。这是因为我从 SQL Management Studio 生成了一个 sql 脚本。 normalize inconsistent line endings 解决方案也在 SQL Management Studio 中。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2023-03-13
        • 2020-01-28
        • 1970-01-01
        • 2021-11-05
        • 2010-09-29
        • 2016-09-07
        • 2019-11-26
        相关资源
        最近更新 更多