Skip to content

Commit

Permalink
add new pseudonyms check constraint in a concurrent-friendly way
Browse files Browse the repository at this point in the history
Change-Id: I1cb15f96c23937746a104b536b05395d01ee424e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/346565
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
  • Loading branch information
ccutrer committed May 2, 2024
1 parent 2010c37 commit 986a628
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion db/migrate/20240429191100_add_pseudonym_login_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ def change

# login_attribute can only be set if authentication_provider_id is set
# conversely, if authentication_provider_id IS NULL, login_attribute MUST be NULL
t.check_constraint <<~SQL.squish, name: "check_login_attribute_authentication_provider_id", if_not_exists: true
t.check_constraint <<~SQL.squish, name: "check_login_attribute_authentication_provider_id", validate: false, if_not_exists: true
authentication_provider_id IS NOT NULL OR login_attribute IS NULL
SQL
connection.validate_constraint :pseudonyms, "check_login_attribute_authentication_provider_id"

t.index "LOWER(unique_id), account_id, authentication_provider_id, login_attribute",
name: "index_pseudonyms_unique_with_login_attribute",
Expand Down

0 comments on commit 986a628

Please sign in to comment.