-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update PatientSession indexes (#2740)
This updates the indexes on the patient session model to remove an unnecessary unique index and add missing indexes on the patient and session column. The index on the individual columns should improve performance when looking up individual patient sessions for a patient or a session, related to the foreign key added in b350c8e. The unique index on `session_id` and `patient_id` is unnecessary as we already have an index on `patient_id` and `session_id`.
- Loading branch information
Showing
5 changed files
with
18 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
class UpdatePatientSessionIndexes < ActiveRecord::Migration[8.0] | ||
def change | ||
remove_index :patient_sessions, %i[session_id patient_id], unique: true | ||
add_index :patient_sessions, :patient_id | ||
add_index :patient_sessions, :session_id | ||
end | ||
end |
This file contains 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
This file contains 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
This file contains 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