OMOP/ddl/5.4/bigquery/OMOPCDM_bigquery_5.4_primar...

58 lines
3.3 KiB
MySQL
Raw Normal View History

--bigquery CDM Primary Key Constraints for OMOP Common Data Model 5.4
alter table @cdmDatabaseSchema.person add constraint xpk_person primary key nonclustered (person_id);
alter table @cdmDatabaseSchema.observation_period add constraint xpk_observation_period primary key nonclustered (observation_period_id);
alter table @cdmDatabaseSchema.visit_occurrence add constraint xpk_visit_occurrence primary key nonclustered (visit_occurrence_id);
alter table @cdmDatabaseSchema.visit_detail add constraint xpk_visit_detail primary key nonclustered (visit_detail_id);
alter table @cdmDatabaseSchema.condition_occurrence add constraint xpk_condition_occurrence primary key nonclustered (condition_occurrence_id);
alter table @cdmDatabaseSchema.drug_exposure add constraint xpk_drug_exposure primary key nonclustered (drug_exposure_id);
alter table @cdmDatabaseSchema.procedure_occurrence add constraint xpk_procedure_occurrence primary key nonclustered (procedure_occurrence_id);
alter table @cdmDatabaseSchema.device_exposure add constraint xpk_device_exposure primary key nonclustered (device_exposure_id);
alter table @cdmDatabaseSchema.measurement add constraint xpk_measurement primary key nonclustered (measurement_id);
alter table @cdmDatabaseSchema.observation add constraint xpk_observation primary key nonclustered (observation_id);
alter table @cdmDatabaseSchema.note add constraint xpk_note primary key nonclustered (note_id);
alter table @cdmDatabaseSchema.note_nlp add constraint xpk_note_nlp primary key nonclustered (note_nlp_id);
alter table @cdmDatabaseSchema.specimen add constraint xpk_specimen primary key nonclustered (specimen_id);
alter table @cdmDatabaseSchema.location add constraint xpk_location primary key nonclustered (location_id);
alter table @cdmDatabaseSchema.care_site add constraint xpk_care_site primary key nonclustered (care_site_id);
alter table @cdmDatabaseSchema.provider add constraint xpk_provider primary key nonclustered (provider_id);
alter table @cdmDatabaseSchema.payer_plan_period add constraint xpk_payer_plan_period primary key nonclustered (payer_plan_period_id);
alter table @cdmDatabaseSchema.cost add constraint xpk_cost primary key nonclustered (cost_id);
alter table @cdmDatabaseSchema.drug_era add constraint xpk_drug_era primary key nonclustered (drug_era_id);
alter table @cdmDatabaseSchema.dose_era add constraint xpk_dose_era primary key nonclustered (dose_era_id);
alter table @cdmDatabaseSchema.condition_era add constraint xpk_condition_era primary key nonclustered (condition_era_id);
Add unit tests for all databases and DDLs (#431) * Add github actions workflow to build package and run tests. * update Description file * rename .Rproj file. * Consolidate 'create' functions into one file. * Add tests for create functions. * update description * removed spaces in file and folder names. Regenerated ddl output. Tried to fix Field_Level.csv file. * consolidate write functions into one file. Add execute function. * update docs * add tests for write and execute functions * update documentation * Add windows and linux runners in github actions. * update github actions * download drivers before running tests * fix small error in setup test file. * debug github actions * debug github actions * debug github actions * debug github actions * fix tiny bug * comment out execute ddl test * fix bug in test * Add execute test back in * revert accidental change in description * add print statement for debugging schema error on github actions. * Fix schema environment variable name * Add comment to github actions workflow file. * remove placeholder text in function documentation. * Rename createdDdl.R to createDdl.R * Hack-a-thon updates Closes #81, #387, #239, #412, #391, #330, #408, #365, #306, #264 * Changed bigint to integer for consistency * Updated DDLs * Add tests for redshift. Clean up test setup file. * Foreign key fixes * Add imports and update docs. * Fix bug in setup test script. * update setup file * Add tests for oracle and sql server. Move setup.R file. * fix bug in setup * debug tests on github * debug github actions * debug actions. * debug actions * debug actions. * Add missing secrets to yaml!! * debug actions * test connection on all platforms * add ddl execution * add windows and linux runners Co-authored-by: Adam Black <adam.black@odysseusinc.com> Co-authored-by: Clair Blacketer <mblacke@its.jnj.com>
2021-08-20 11:59:29 +00:00
alter table @cdmDatabaseSchema.episode add constraint xpk_episode primary key nonclustered (episode_id);
alter table @cdmDatabaseSchema.metadata add constraint xpk_metadata primary key nonclustered (metadata_id);
alter table @cdmDatabaseSchema.concept add constraint xpk_concept primary key nonclustered (concept_id);
alter table @cdmDatabaseSchema.vocabulary add constraint xpk_vocabulary primary key nonclustered (vocabulary_id);
alter table @cdmDatabaseSchema.domain add constraint xpk_domain primary key nonclustered (domain_id);
alter table @cdmDatabaseSchema.concept_class add constraint xpk_concept_class primary key nonclustered (concept_class_id);
alter table @cdmDatabaseSchema.relationship add constraint xpk_relationship primary key nonclustered (relationship_id);