Fixing the uid Column isn't unique.

uid is required to be unique for the the Changed Events (with the new Data) to be inserted without creating new Rows.
This commit is contained in:
2025-11-03 00:22:01 +00:00
parent 1a7de55da8
commit eea37b3df5
7 changed files with 86 additions and 7 deletions

View File

@@ -0,0 +1 @@
CREATE UNIQUE INDEX idx_events_uid ON events(uid);

View File

@@ -0,0 +1,6 @@
DELETE FROM events
WHERE rowid NOT IN (
SELECT MIN(rowid)
FROM events
GROUP BY uid
);

View File

@@ -0,0 +1,4 @@
SELECT uid, COUNT(*) AS count
FROM events
GROUP BY uid
HAVING COUNT(*) > 1;