【发布时间】:2020-02-10 11:45:36
【问题描述】:
H2Dialect.dropConstraints 有评论
// We don't need to drop constraints before dropping tables, that just leads to error
// messages about missing tables when we don't have a schema in the database
但这似乎是错误的,当我的下一个单元测试类从自定义属性集开始时
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {
"aaa=bbb"})
创建了一个新的上下文,Hibernate 尝试删除模式以重新创建它。这会导致约束异常:
Cannot drop "XXX" because "FK_XXX, FK_XXX, FK_XXX, FK_XXX" depends on it; SQL statement:
drop table xxx if exists [90107-200]
为什么 H2Dialect 不能正确删除约束?
【问题讨论】: