diff options
author | Akshay" (aider) <[email protected]> | 2024-11-08 22:24:40 +0000 |
---|---|---|
committer | Akshay" (aider) <[email protected]> | 2024-11-08 22:24:40 +0000 |
commit | 115b44441d1d28925a52668d6ca305be93dfb5ae (patch) | |
tree | 0f88a68da17aa079fafebf2a5f583fa143447184 /src/index.js | |
parent | 5cfd8d35ac937799dcf6079b3412e6f2d76b6a4f (diff) |
fix: add unique constraint to user_id and subreddit in subscriptions table
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 3 |
1 files changed, 2 insertions, 1 deletions
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(` | |||
28 | id INTEGER PRIMARY KEY AUTOINCREMENT, | 28 | id INTEGER PRIMARY KEY AUTOINCREMENT, |
29 | user_id INTEGER, | 29 | user_id INTEGER, |
30 | subreddit TEXT, | 30 | subreddit TEXT, |
31 | FOREIGN KEY(user_id) REFERENCES users(id) | 31 | FOREIGN KEY(user_id) REFERENCES users(id), |
32 | UNIQUE(user_id, subreddit) | ||
32 | ) | 33 | ) |
33 | `); | 34 | `); |
34 | 35 | ||