Clean child sessions in iam membership migration
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -50,13 +50,24 @@ 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
|
||||||
|
iam_memberships
|
||||||
|
WHERE
|
||||||
|
id IN (
|
||||||
|
SELECT
|
||||||
|
old_id
|
||||||
|
FROM
|
||||||
|
old_to_new
|
||||||
|
) RETURNING id
|
||||||
)
|
)
|
||||||
DELETE FROM
|
DELETE FROM
|
||||||
iam_memberships
|
iam_sessions
|
||||||
WHERE
|
WHERE
|
||||||
id IN (
|
membership_id IN (
|
||||||
SELECT
|
SELECT
|
||||||
old_id
|
old_id
|
||||||
FROM
|
FROM
|
||||||
old_to_new
|
old_to_new
|
||||||
) RETURNING id;
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user