2021-08-18 19:30:04 +00:00
|
|
|
--redshift CDM Primary Key Constraints for OMOP Common Data Model 5.4
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.PERSON ADD CONSTRAINT xpk_PERSON PRIMARY KEY (person_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.OBSERVATION_PERIOD ADD CONSTRAINT xpk_OBSERVATION_PERIOD PRIMARY KEY (observation_period_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT xpk_VISIT_OCCURRENCE PRIMARY KEY (visit_occurrence_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT xpk_VISIT_DETAIL PRIMARY KEY (visit_detail_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.CONDITION_OCCURRENCE ADD CONSTRAINT xpk_CONDITION_OCCURRENCE PRIMARY KEY (condition_occurrence_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.DRUG_EXPOSURE ADD CONSTRAINT xpk_DRUG_EXPOSURE PRIMARY KEY (drug_exposure_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.PROCEDURE_OCCURRENCE ADD CONSTRAINT xpk_PROCEDURE_OCCURRENCE PRIMARY KEY (procedure_occurrence_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.DEVICE_EXPOSURE ADD CONSTRAINT xpk_DEVICE_EXPOSURE PRIMARY KEY (device_exposure_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT xpk_MEASUREMENT PRIMARY KEY (measurement_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT xpk_OBSERVATION PRIMARY KEY (observation_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT xpk_NOTE PRIMARY KEY (note_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.NOTE_NLP ADD CONSTRAINT xpk_NOTE_NLP PRIMARY KEY (note_nlp_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.SPECIMEN ADD CONSTRAINT xpk_SPECIMEN PRIMARY KEY (specimen_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.LOCATION ADD CONSTRAINT xpk_LOCATION PRIMARY KEY (location_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.CARE_SITE ADD CONSTRAINT xpk_CARE_SITE PRIMARY KEY (care_site_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.PROVIDER ADD CONSTRAINT xpk_PROVIDER PRIMARY KEY (provider_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.PAYER_PLAN_PERIOD ADD CONSTRAINT xpk_PAYER_PLAN_PERIOD PRIMARY KEY (payer_plan_period_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.COST ADD CONSTRAINT xpk_COST PRIMARY KEY (cost_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.DRUG_ERA ADD CONSTRAINT xpk_DRUG_ERA PRIMARY KEY (drug_era_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.DOSE_ERA ADD CONSTRAINT xpk_DOSE_ERA PRIMARY KEY (dose_era_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.CONDITION_ERA ADD CONSTRAINT xpk_CONDITION_ERA PRIMARY KEY (condition_era_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.CONCEPT ADD CONSTRAINT xpk_CONCEPT PRIMARY KEY (concept_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.VOCABULARY ADD CONSTRAINT xpk_VOCABULARY PRIMARY KEY (vocabulary_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.DOMAIN ADD CONSTRAINT xpk_DOMAIN PRIMARY KEY (domain_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.CONCEPT_CLASS ADD CONSTRAINT xpk_CONCEPT_CLASS PRIMARY KEY (concept_class_id);
|
2021-08-18 18:24:45 +00:00
|
|
|
|
2021-08-18 19:30:04 +00:00
|
|
|
ALTER TABLE @cdmDatabaseSchema.RELATIONSHIP ADD CONSTRAINT xpk_RELATIONSHIP PRIMARY KEY (relationship_id);
|