aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/db/migrations/005_add_guid_index.sql
diff options
context:
space:
mode:
authornsfisis <54318333+nsfisis@users.noreply.github.com>2026-01-12 18:13:30 +0900
committerGitHub <noreply@github.com>2026-01-12 18:13:30 +0900
commit8ca7887979bb045eea6331360b2bedc6de7f3d34 (patch)
treefbf632ed9c179dd109afa6e1749a446f540a45c4 /backend/db/migrations/005_add_guid_index.sql
parent67bfaf8f103295c5562db02a0044e311e3504518 (diff)
parent86254f8eb7f812915464c8733f7017a6e0a3dd4d (diff)
downloadfeedaka-8ca7887979bb045eea6331360b2bedc6de7f3d34.tar.gz
feedaka-8ca7887979bb045eea6331360b2bedc6de7f3d34.tar.zst
feedaka-8ca7887979bb045eea6331360b2bedc6de7f3d34.zip
Merge pull request #2 from nsfisis/claude/deduplicate-feed-items-JDLw3HEADmain
Prevent duplicate feed items with same GUID
Diffstat (limited to 'backend/db/migrations/005_add_guid_index.sql')
-rw-r--r--backend/db/migrations/005_add_guid_index.sql10
1 files changed, 10 insertions, 0 deletions
diff --git a/backend/db/migrations/005_add_guid_index.sql b/backend/db/migrations/005_add_guid_index.sql
new file mode 100644
index 0000000..e3625ee
--- /dev/null
+++ b/backend/db/migrations/005_add_guid_index.sql
@@ -0,0 +1,10 @@
+-- Add index on guid for deduplication
+CREATE INDEX IF NOT EXISTS idx_articles_guid ON articles(guid);
+
+-- Remove duplicate articles by guid, keeping only the one with the smallest id
+DELETE FROM articles
+WHERE id NOT IN (
+ SELECT MIN(id)
+ FROM articles
+ GROUP BY guid
+);