From 115b44441d1d28925a52668d6ca305be93dfb5ae Mon Sep 17 00:00:00 2001 From: "Akshay\" (aider)" Date: Fri, 8 Nov 2024 22:24:40 +0000 Subject: fix: add unique constraint to user_id and subreddit in subscriptions table --- src/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index bb9eb53..ea2fea1 100644 --- a/src/index.js +++ b/src/index.js @@ -28,7 +28,8 @@ db.run(` id INTEGER PRIMARY KEY AUTOINCREMENT, user_id INTEGER, subreddit TEXT, - FOREIGN KEY(user_id) REFERENCES users(id) + FOREIGN KEY(user_id) REFERENCES users(id), + UNIQUE(user_id, subreddit) ) `); -- cgit v1.2.3