Clean child sessions in iam membership migration
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -50,7 +50,8 @@ updated_profiles AS (
|
|||||||
old_to_new m
|
old_to_new m
|
||||||
WHERE
|
WHERE
|
||||||
mp.membership_id = m.old_id RETURNING id
|
mp.membership_id = m.old_id RETURNING id
|
||||||
)
|
),
|
||||||
|
deleted_memberships AS (
|
||||||
DELETE FROM
|
DELETE FROM
|
||||||
iam_memberships
|
iam_memberships
|
||||||
WHERE
|
WHERE
|
||||||
@@ -59,4 +60,14 @@ WHERE
|
|||||||
old_id
|
old_id
|
||||||
FROM
|
FROM
|
||||||
old_to_new
|
old_to_new
|
||||||
) RETURNING id;
|
) RETURNING id
|
||||||
|
)
|
||||||
|
DELETE FROM
|
||||||
|
iam_sessions
|
||||||
|
WHERE
|
||||||
|
membership_id IN (
|
||||||
|
SELECT
|
||||||
|
old_id
|
||||||
|
FROM
|
||||||
|
old_to_new
|
||||||
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user