由于掉落限制,无法清理Flyway Clean

时间:2019-04-23 17:36:27

标签: sql-server database-migration flyway

我正在尝试clean我的MSSQL数据库。我正在某些数据库上工作,但是在其中一个数据库上,出现以下错误。

Unable to clean schema [dbo]
----------------------------
SQL State  : S0001
Error Code : 3717
Message    : Cannot drop a default constraint by DROP DEFAULT statement. Use ALTER TABLE to drop a constraint default.

        at org.flywaydb.core.internal.database.base.Schema.clean(Schema.java:151)
        at org.flywaydb.core.internal.command.DbClean$3.call(DbClean.java:172)
        at org.flywaydb.core.internal.command.DbClean$3.call(DbClean.java:169)
        at org.flywaydb.core.internal.jdbc.TransactionTemplate.execute(TransactionTemplate.java:74)
        at org.flywaydb.core.internal.command.DbClean.cleanSchema(DbClean.java:169)
        at org.flywaydb.core.internal.command.DbClean.clean(DbClean.java:113)
        at org.flywaydb.core.Flyway.doClean(Flyway.java:1488)
        at org.flywaydb.core.Flyway.access$300(Flyway.java:85)
        at org.flywaydb.core.Flyway$3.execute(Flyway.java:1506)
        at org.flywaydb.core.Flyway$3.execute(Flyway.java:1499)
        at org.flywaydb.core.Flyway.execute(Flyway.java:1711)
        at org.flywaydb.core.Flyway.clean(Flyway.java:1499)
        at org.flywaydb.commandline.Main.executeOperation(Main.java:157)
        at org.flywaydb.commandline.Main.main(Main.java:108)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot drop a default constraint by DROP DEFAULT statement. Use ALTER TABLE to drop a con
straint default.
        at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:254)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1608)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:578)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:508)
        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7240)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2869)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:243)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:218)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.execute(SQLServerPreparedStatement.java:493)
        at org.flywaydb.core.internal.jdbc.JdbcTemplate.execute(JdbcTemplate.java:215)
        at org.flywaydb.core.internal.database.sqlserver.SQLServerSchema.doClean(SQLServerSchema.java:294)
        at org.flywaydb.core.internal.database.base.Schema.clean(Schema.java:149)
        ... 13 more

我的许多表都有某些列的默认约束。但是我看不到如何改变飞行路线如何降低这些限制。我找不到有关如何解决此问题的任何信息。如果您有任何见解,请提供帮助。谢谢!

1 个答案:

答案 0 :(得分:0)

请在issue tracker中提交问题,并提供确切的步骤来重现包括触发该问题的最小SQL文件的方法。