diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-10-27 01:32:19 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-10-27 01:42:51 +0900 |
| commit | 469e469dd3f77bc8cd22bbcd87017eb69569ac23 (patch) | |
| tree | b8f83ed851d9072bb7f4e5c5215cf0ab9afe56b2 /backend/db/migrations | |
| parent | ce9f81abd531707b7341a5d92544954ab18ac390 (diff) | |
| download | feedaka-469e469dd3f77bc8cd22bbcd87017eb69569ac23.tar.gz feedaka-469e469dd3f77bc8cd22bbcd87017eb69569ac23.tar.zst feedaka-469e469dd3f77bc8cd22bbcd87017eb69569ac23.zip | |
feat(backend): Create users table
Diffstat (limited to 'backend/db/migrations')
| -rw-r--r-- | backend/db/migrations/003_add_users_table.sql | 15 |
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); |
