Open sameertj opened 2 years ago
Regarding the docs this table has no primary key https://ohdsi.github.io/CommonDataModel/cdm54.html#cohort
There are multiple tables with no PK.
cohort
cdm_source
cohort_definition
concept_ancestor
concept_synonym
drug_strength
fact_relationship
source_to_concept_map
concept_relationship
death
episode_event
It is not prohibited to create tables without PKs, but it is at least awkward. from a database-operator and developer perspective, it makes some common tasks unnecessary complicated. I can not see the benefit, we get from the non-extisting PKs. Does anyone can provide the rational behind this design decision? I could not find anything. If there is none, i would highly be in favor of having a primary key for every table in future CDM versions. :heart:
I can create a PR if favored.
The OMOPCDM_postgresql_5.4_primary_keys.sql script for CDM 5.4 does not define a primary key for the Cohort table. This breaks the OMOPCDM_postgresql_5.4_constraints.sql script.
The fix is to add the following to the OMOPCDM_postgresql_5.4_constraints.sql script:
ALTER TABLE @cdmDatabaseSchema.COHORT ADD CONSTRAINT xpk_COHORT PRIMARY KEY (cohort_definition_id);