From 469e469dd3f77bc8cd22bbcd87017eb69569ac23 Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Mon, 27 Oct 2025 01:32:19 +0900
Subject: feat(backend): Create users table

---
 backend/db/migrations/003_add_users_table.sql | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 backend/db/migrations/003_add_users_table.sql

(limited to 'backend/db/migrations/003_add_users_table.sql')

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);
-- 
cgit v1.2.3-70-g09d2

