fix baseline migration script#2515
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adjusts the ordering of sec_{entity} foreign key constraint creation in the PostgreSQL baseline migration so that referenced primary keys/constraints are in place before the FKs are added.
Changes:
- Removed the
sec_{entity}FKALTER TABLE ... ADD CONSTRAINTblock from thesec_{entity}table creation area. - Added a note pointing readers to the later FK section.
- Reintroduced the
sec_{entity}FK constraint block later in the script (after relevant PK/constraint definitions).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1733
to
+1734
| ALTER TABLE ${ohdsiSchema}.sec_cohort_characterization | ||
| ADD CONSTRAINT fk_scc_sec_role_id |
Comment on lines
+1134
to
+1135
| -- down (search for "fk_scc_sec_role_id") because they reference primary keys | ||
| -- on sec_role and other tables that are not added until later in this script. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request reorganizes where the foreign key (FK) constraints for the
sec_{entity}tables are declared in theB3.0.0__webapi_baseline.sqlmigration script. The FK constraints, which enforce referential integrity and useON DELETE CASCADE, have been moved to a later section of the script to ensure that all referenced tables and primary keys exist before the constraints are added. No logic has changed, but the order of operations has been adjusted.