Skip to content

Commit 1af0155

Browse files
committed
Keep newest duplicate user active
1 parent 1ac0f7c commit 1af0155

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎priv/repo/migrations/20260807052500_allow_reusing_deleted_user_emails.exs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ defmodule Claper.Repo.Migrations.AllowReusingDeletedUserEmails do
88
WITH ranked_users AS (
99
SELECT
1010
id,
11-
ROW_NUMBER() OVER (PARTITION BY email ORDER BY inserted_at, id) AS email_position
11+
ROW_NUMBER() OVER (PARTITION BY email ORDER BY inserted_at DESC, id DESC) AS email_position
1212
FROM users
1313
WHERE deleted_at IS NULL
1414
)

0 commit comments

Comments
 (0)