Add userName and externalID support

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-03-09 16:06:32 +01:00
parent b2378a2d7a
commit c8250f6794
6 changed files with 223 additions and 51 deletions

View File

@@ -0,0 +1,16 @@
ALTER TABLE iam_membership_profiles
ADD COLUMN user_name TEXT,
ADD COLUMN external_id TEXT;
UPDATE iam_membership_profiles p
SET user_name = i.email_address
FROM identities i
WHERE i.id = p.identity_id AND p.source = 'SCIM';
CREATE UNIQUE INDEX idx_profiles_user_name_organization_id
ON iam_membership_profiles (user_name, organization_id)
WHERE user_name IS NOT NULL;
CREATE UNIQUE INDEX idx_profiles_external_id_organization_id
ON iam_membership_profiles (external_id, organization_id)
WHERE external_id IS NOT NULL;