aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/db/schema.sql
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-07-12 17:11:13 +0900
committernsfisis <nsfisis@gmail.com>2025-07-12 17:52:54 +0900
commitfbe4bff7e8b6a5239c490601436fb3638dc8e13b (patch)
treeb011c43d20ebfc4566cdbe95ed878c9644797e37 /backend/db/schema.sql
parentdb4f7f4ee12ab52ff249b29496a9f0997e3dbbf5 (diff)
downloadfeedaka-fbe4bff7e8b6a5239c490601436fb3638dc8e13b.tar.gz
feedaka-fbe4bff7e8b6a5239c490601436fb3638dc8e13b.tar.zst
feedaka-fbe4bff7e8b6a5239c490601436fb3638dc8e13b.zip
feat(backend): introduce sqlc
Diffstat (limited to 'backend/db/schema.sql')
-rw-r--r--backend/db/schema.sql25
1 files changed, 25 insertions, 0 deletions
diff --git a/backend/db/schema.sql b/backend/db/schema.sql
new file mode 100644
index 0000000..5c2bf48
--- /dev/null
+++ b/backend/db/schema.sql
@@ -0,0 +1,25 @@
+-- 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
+);
+
+-- Articles
+CREATE TABLE IF NOT EXISTS articles (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ feed_id INTEGER NOT NULL,
+ guid TEXT NOT NULL,
+ title TEXT NOT NULL,
+ url TEXT NOT NULL,
+ is_read INTEGER NOT NULL DEFAULT 0,
+ FOREIGN KEY (feed_id) REFERENCES feeds(id) ON DELETE CASCADE
+);
+
+-- Indice
+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);