mirror of
https://github.com/ClaperCo/Claper.git
synced 2026-08-29 10:09:08 +02:00
Keep newest duplicate user active
This commit is contained in:
@@ -8,7 +8,7 @@ defmodule Claper.Repo.Migrations.AllowReusingDeletedUserEmails do
|
|||||||
WITH ranked_users AS (
|
WITH ranked_users AS (
|
||||||
SELECT
|
SELECT
|
||||||
id,
|
id,
|
||||||
ROW_NUMBER() OVER (PARTITION BY email ORDER BY inserted_at, id) AS email_position
|
ROW_NUMBER() OVER (PARTITION BY email ORDER BY inserted_at DESC, id DESC) AS email_position
|
||||||
FROM users
|
FROM users
|
||||||
WHERE deleted_at IS NULL
|
WHERE deleted_at IS NULL
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user