From 7abf2227438362ad30820ee236405ec1b57a40b6 Mon Sep 17 00:00:00 2001
From: polwex <polwex@sortug.com>
Date: Wed, 21 May 2025 17:13:11 +0700
Subject: m

---
 src/lib/db/schema.sql | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'src/lib/db/schema.sql')

diff --git a/src/lib/db/schema.sql b/src/lib/db/schema.sql
index 4506619..129400a 100644
--- a/src/lib/db/schema.sql
+++ b/src/lib/db/schema.sql
@@ -58,10 +58,13 @@ CREATE INDEX IF NOT EXISTS idx_senses_parent ON senses(parent_id);
 
 
 CREATE TABLE IF NOT EXISTS bookmarks(
-    word_id INTEGER PRIMARY KEY,
+    word_id INTEGER NOT NULL,
+    user_id INTEGER NOT NULL,
     notes   TEXT,
     created INTEGER NOT NULL,
-    FOREIGN KEY (word_id) REFERENCES expressions(id)
+    PRIMARY KEY (word_id, user_id),
+    FOREIGN KEY (word_id) REFERENCES expressions(id),
+    FOREIGN KEY (user_id) REFERENCES users(id)
 );
 CREATE INDEX IF NOT EXISTS idx_bookmarks ON bookmarks(word_id);
 
-- 
cgit v1.2.3

