mirror of
https://github.com/ClaperCo/Claper.git
synced 2026-08-29 01:58:48 +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 (
|
||||
SELECT
|
||||
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
|
||||
WHERE deleted_at IS NULL
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user