diff options
| author | nsfisis <54318333+nsfisis@users.noreply.github.com> | 2026-01-12 18:13:30 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-12 18:13:30 +0900 |
| commit | 8ca7887979bb045eea6331360b2bedc6de7f3d34 (patch) | |
| tree | fbf632ed9c179dd109afa6e1749a446f540a45c4 /backend/db/migrations | |
| parent | 67bfaf8f103295c5562db02a0044e311e3504518 (diff) | |
| parent | 86254f8eb7f812915464c8733f7017a6e0a3dd4d (diff) | |
| download | feedaka-8ca7887979bb045eea6331360b2bedc6de7f3d34.tar.gz feedaka-8ca7887979bb045eea6331360b2bedc6de7f3d34.tar.zst feedaka-8ca7887979bb045eea6331360b2bedc6de7f3d34.zip | |
Prevent duplicate feed items with same GUID
Diffstat (limited to 'backend/db/migrations')
| -rw-r--r-- | backend/db/migrations/005_add_guid_index.sql | 10 |
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 +); |
