We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 02d42fc commit c79f10aCopy full SHA for c79f10a
coderd/database/migrations/000205_unique_linked_id.up.sql
@@ -11,8 +11,8 @@ SET
11
-- When the count of linked_id is greater than 1, set the linked_id to empty
12
SELECT COUNT(*)
13
FROM user_links inn
14
- WHERE out.linked_id = inn.linked_id
+ WHERE out.linked_id = inn.linked_id AND out.login_type = inn.login_type
15
) > 1 THEN '' ELSE out.linked_id END;
16
17
-- Enforce unique linked_id constraint on non-empty linked_id
18
-CREATE UNIQUE INDEX idx_user_link_linked_id ON user_links USING btree (linked_id) WHERE (linked_id != '');
+CREATE UNIQUE INDEX idx_user_link_linked_id ON user_links USING btree (linked_id, login_type) WHERE (linked_id != '');
0 commit comments