【发布时间】:2020-03-11 19:53:57
【问题描述】:
在进行与 jOOQ 无关的(无代码生成)迁移时,我遇到了一种情况,即我需要检查数据库中是否已经存在约束(唯一、外键)以完成进一步的操作。
到目前为止,我尝试的是运行 drop 并尝试捕获异常,但它使事务失败并停止跟随迁移的发生
dsl.alterTable(table).dropConstraint(constraintName).execute();
...
>> ERROR: constraint "t_client_name_unique" of relation "t_client" does not exist
设置:
- 春天
- 没有代码生成的 jOOQ
- FlywayDB 作为迁移库
- Postgres
【问题讨论】: