aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/db/schema.sql
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-10-27 01:32:19 +0900
committernsfisis <nsfisis@gmail.com>2025-10-27 01:42:51 +0900
commit469e469dd3f77bc8cd22bbcd87017eb69569ac23 (patch)
treeb8f83ed851d9072bb7f4e5c5215cf0ab9afe56b2 /backend/db/schema.sql
parentce9f81abd531707b7341a5d92544954ab18ac390 (diff)
downloadfeedaka-469e469dd3f77bc8cd22bbcd87017eb69569ac23.tar.gz
feedaka-469e469dd3f77bc8cd22bbcd87017eb69569ac23.tar.zst
feedaka-469e469dd3f77bc8cd22bbcd87017eb69569ac23.zip
feat(backend): Create users table
Diffstat (limited to 'backend/db/schema.sql')
-rw-r--r--backend/db/schema.sql13
1 files changed, 12 insertions, 1 deletions
diff --git a/backend/db/schema.sql b/backend/db/schema.sql
index eb40dea..e1260b0 100644
--- a/backend/db/schema.sql
+++ b/backend/db/schema.sql
@@ -1,10 +1,19 @@
+-- Users
+CREATE TABLE IF NOT EXISTS users (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ username TEXT NOT NULL UNIQUE,
+ password_hash TEXT NOT NULL,
+ created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
-- Feeds
CREATE TABLE IF NOT EXISTS feeds (
id INTEGER PRIMARY KEY AUTOINCREMENT,
url TEXT NOT NULL,
title TEXT NOT NULL,
fetched_at TEXT NOT NULL,
- is_subscribed INTEGER NOT NULL DEFAULT 1
+ is_subscribed INTEGER NOT NULL DEFAULT 1,
+ user_id INTEGER REFERENCES users(id) ON DELETE CASCADE
);
-- Articles
@@ -24,3 +33,5 @@ CREATE INDEX IF NOT EXISTS idx_articles_feed_id ON articles(feed_id);
CREATE INDEX IF NOT EXISTS idx_articles_feed_guid ON articles(feed_id, guid);
CREATE INDEX IF NOT EXISTS idx_articles_is_read ON articles(is_read);
+
+CREATE INDEX IF NOT EXISTS idx_feeds_user_id ON feeds(user_id);