Rename location_id on patient_locations (part 1 of 3)#6743
Open
thomasleese wants to merge 3 commits intonextfrom
Open
Rename location_id on patient_locations (part 1 of 3)#6743thomasleese wants to merge 3 commits intonextfrom
location_id on patient_locations (part 1 of 3)#6743thomasleese wants to merge 3 commits intonextfrom
Conversation
This adds a `school_id` column to the `patient_locations` table which will eventually replace the `location_id` column. We're doing this because the plan is for the patient-location association to belong an explicit patient-school association, while the association between patients and clinics is built using a different mechanism. Jira-Issue: MAV-7114 Jira-Issue: MAV-7113
In the previous commit we added a `school_id` column which will eventually replace the `location_id` column. This change ensures that when saving or updating patient locations, we set the `school_id` column matching the value of the `location_id` column. Once we're confident both columns are being written to we will stop writing to `location_id` and eventually remove it. Jira-Issue: MAV-7114 Jira-Issue: MAV-7113
In the previous two commits we added a `school_id` column on `patient_locations`. This commit adds a data migration to make sure it is populated for existing rows. Jira-Issue: MAV-7114 Jira-Issue: MAV-7113
location_id on patient_locations (part 1 of 3)
location_id on patient_locations (part 1 of 3)location_id on patient_locations (part 1 of 3)
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 is the first part of renaming the
location_idcolumn onpatient_locationstoschool_id. To ensure a zero-downtime migration, we need to rename the column in multiple parts.We're renaming the column to
school_idas the table itself is going to be renamed topatient_schools, to better reflect the fact that this is used to model the relationship between children and their school. Although it currently, and will for now continue, to be used for clinic sessions as well, this will eventually be replaced by a different model as the relationship between children and clinics works differently.Jira Issue - MAV-7114 · Jira Issue - MAV-7113