SQL Server Error 1785: Migration V2.9.0.20210423125133__assets_tags.sql fails with cascade delete conflict
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 db/migration/sqlserver/V2.9.0.20210423125133__assets_tags.sql 开始,检查 webapi.tag_groups 上的两个外键。在全新的 SQL Server 数据库上运行 Flyway migration 以重现 Error 1785,然后验证 migration 是否能够成功完成,且不会引入无效的级联路径。
由索引模型根据 Issue 内容生成。
描述
Description
The Flyway migration V2.9.0.20210423125133__assets_tags.sql fails on SQL Server with Error 1785 due to multiple cascade delete paths on the tag_groups table.
Environment
- WebAPI Version: 2.8.1
- Database: Microsoft SQL Server 12.0 (Azure SQL Database)
- Database Driver: com.microsoft.sqlserver.jdbc.SQLServerDriver (mssql-jdbc-10.2.1)
- Flyway Version: 4.2.0
Error Message
SQL State : S0000
Error Code : 1785
Message : Introducing FOREIGN KEY constraint 'tag_groups_tag_fk' on table 'tag_groups' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
Location : db/migration/sqlserver/V2.9.0.20210423125133__assets_tags.sql
Root Cause
The migration creates the tag_groups table with two foreign keys, both with ON DELETE CASCADE, both referencing the same parent table (tags):
CREATE TABLE webapi.tag_groups
(
tag_id INT NOT NULL,
group_id INT NOT NULL,
CONSTRAINT tag_groups_group_fk FOREIGN KEY (group_id) REFERENCES webapi.tags (id) ON DELETE CASCADE,
CONSTRAINT tag_groups_tag_fk FOREIGN KEY (tag_id) REFERENCES webapi.tags (id) ON DELETE CASCADE
);
Steps to Reproduce
- Set up fresh SQL Server database
- Configure WebAPI 2.8.1 to connect to SQL Server
- Enable Flyway migrations
- Start application
- Migration fails with Error 1785
Logs
- 主要语言
- Java
- 星标
- 153
- 派生
- 187
- 平均合并
- 1 天 1 小时
- 30 天内合并 PR
- 15
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
OHDSI/WebAPI 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
CDM cache warming still fails when cache.achilles.usePersonCount=false (missing `cc` alias in getBatchConceptRecordCount.sql)可能已有人在做 @DG47 于 4 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 67/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复
相似的 Issue
-
Shaded google-api-client trust stores still include AAA Certificate Services (eMudhra CA compromise)未关闭
难度 2/5 1-3 小时 新手友好度 72/100
snowflakedb/snowflake-jdbc#2763 ·
-
难度 1/5 1 小时以内 新手友好度 79/100
java-native-access/jna#1746 ·
-
Pooled clients leak a connection per call: pipelines and transactions taken from UnifiedJedis are never closed可能已有人在做 @ali-jawad 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 77/100
-
kind:bug state:needs-triage
难度 2/5 1-3 小时 新手友好度 72/100
OpenLineage/OpenLineage#5100 · 1 条评论 ·
维护者通常 4 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
adorsys/keycloak-config-cli#1709 ·
维护者通常 1 天内回复