aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/db/migrations/003_add_users_table.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/migrations/003_add_users_table.sql
parentce9f81abd531707b7341a5d92544954ab18ac390 (diff)
downloadfeedaka-469e469dd3f77bc8cd22bbcd87017eb69569ac23.tar.gz
feedaka-469e469dd3f77bc8cd22bbcd87017eb69569ac23.tar.zst
feedaka-469e469dd3f77bc8cd22bbcd87017eb69569ac23.zip
feat(backend): Create users table
Diffstat (limited to 'backend/db/migrations/003_add_users_table.sql')
-rw-r--r--backend/db/migrations/003_add_users_table.sql15
1 files changed, 15 insertions, 0 deletions
diff --git a/backend/db/migrations/003_add_users_table.sql b/backend/db/migrations/003_add_users_table.sql
new file mode 100644
index 0000000..4cf963b
--- /dev/null
+++ b/backend/db/migrations/003_add_users_table.sql
@@ -0,0 +1,15 @@
+-- Add users table and user_id column to feeds table.
+
+-- 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
+);
+
+-- Add user_id to feeds table
+ALTER TABLE feeds ADD COLUMN user_id INTEGER REFERENCES users(id) ON DELETE CASCADE;
+
+-- Index for feeds.user_id
+CREATE INDEX IF NOT EXISTS idx_feeds_user_id ON feeds(user_id);