Fix e2e tests

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-02-18 12:05:53 +04:00
parent b49747f3ba
commit ab5fe8e5e2
30 changed files with 874 additions and 715 deletions

View File

@@ -184,6 +184,27 @@ WHERE
pi.organization_id = i.organization_id
AND pi.email_address = i.email;
-- Delete orphan invitations: e.g. expired invitations that were never accepted
WITH orphan_invitations AS (
SELECT
inv.id
FROM
iam_invitations inv
LEFT JOIN identities i ON i.email_address = inv.email
LEFT JOIN iam_membership_profiles p ON p.identity_id = i.id
WHERE
i.id IS NULL OR p.id IS NULL
)
DELETE FROM
iam_invitations
WHERE
id IN (
SELECT
id
FROM
orphan_invitations
);
ALTER TABLE
iam_invitations
ALTER COLUMN
@@ -197,4 +218,4 @@ ALTER COLUMN
ALTER COLUMN
role DROP NOT NULL,
ALTER COLUMN
full_name DROP NOT NULL;
full_name DROP NOT NULL;