Table PERSON vs EPISODE) foreign key columns to match exactly
还没有人认领这个 Issue。
评估
调研方向
在仓库的 DDL 中定位 PERSON 和 EPISODE 表的定义及其键约束。比较 person_id 的类型,然后验证两者都使用 BIGINT,并确认可以在 SQL Server 上成功创建外键。
由索引模型根据 Issue 内容生成。
描述
SQL Server requires foreign key columns to match exactly.
integer ≠ bigint, so SQL Server refuses to create the FK
How to Fix It
You have two options — choose the one that matches your data model.
Option 1 — Make PERSON.person_id a BIGINT
This is the most common fix if your IDs can grow large.
Option 2,. Not fit for us, as int is not appropriate for person key.
Important Note (OMOP CDM)
Since you’re clearly building OMOP CDM:
PERSON.person_id must be BIGINT
EPISODE.person_id must also be BIGINT
So you’re absolutely doing the right thing.
===============================================
ALTER TABLE PERSON
ALTER COLUMN person_id BIGINT NOT NULL;
ALTER TABLE EPISODE
ADD CONSTRAINT fpk_EPISODE_person_id
FOREIGN KEY (person_id) REFERENCES PERSON(person_id);
ALTER TABLE PERSON
DROP CONSTRAINT xpk_PERSON;
ALTER TABLE PERSON
ALTER COLUMN person_id BIGINT NOT NULL;
ALTER TABLE PERSON
ADD CONSTRAINT xpk_PERSON PRIMARY KEY (person_id);
ALTER TABLE EPISODE
DROP CONSTRAINT fpk_EPISODE_person_id;
ALTER TABLE EPISODE
ADD CONSTRAINT fpk_EPISODE_person_id
FOREIGN KEY (person_id) REFERENCES PERSON(person_id);
- 主要语言
- HTML
- 星标
- 1.1k
- 派生
- 513
- 平均合并
- 8 天 3 小时
- 30 天内合并 PR
- 4
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
OHDSI/CommonDataModel 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 74/100
OHDSI/CommonDataModel#802 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
OHDSI/CommonDataModel#799 ·
-
fix: mark cohort_definition_id as primary key in cohort_definition table for v5.3 and v5.4可能已有人在做 @rtmalikian 于 138 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
OHDSI/CommonDataModel#787 ·
-
难度 3/5 1-2 天 新手友好度 55/100
OHDSI/CommonDataModel#823 ·
-
难度 4/5 3-5 天 新手友好度 35/100
OHDSI/CommonDataModel#797 · 1 条评论 ·
查看 OHDSI/CommonDataModel 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
micronaut-projects/micronaut-redis#844 ·
维护者通常 4 天内回复
-
ai-driven-fuzzing bug Minor
难度 2/5 1-3 小时 新手友好度 82/100
linagora/cozy-client#1826 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
ai-driven-fuzzing bug claude Minor
难度 2/5 1-3 小时 新手友好度 78/100
linagora/twake-calendar-side-service#1434 ·
维护者通常 1 天内回复
-
channels:remove check:passed
难度 1/5 1 小时以内 新手友好度 65/100
维护者通常 4 天内回复