feat(db): add migrations system and push subscriptions persistence
Some checks failed
Build MIPS Binary / build (push) Has been cancelled
Some checks failed
Build MIPS Binary / build (push) Has been cancelled
- Add sqlx migration system with migrations/ directory - Create 001_init.sql and 002_push_subscriptions.sql migration files - Move from manual CREATE TABLE to version-controlled migrations - Add push_subscriptions table with DB persistence - PushSubscriptionStore now loads from DB on startup - Add save/remove/get methods for push subscriptions in db.rs - Move VAPID keys to .env file (with fallback to hardcoded values) - Delete old vibetorrent.db and recreate with migrations
This commit is contained in:
16
backend/migrations/001_init.sql
Normal file
16
backend/migrations/001_init.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
-- 001_init.sql
|
||||
-- Initial schema for users and sessions
|
||||
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id INTEGER PRIMARY KEY,
|
||||
username TEXT NOT NULL UNIQUE,
|
||||
password_hash TEXT NOT NULL,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS sessions (
|
||||
token TEXT PRIMARY KEY,
|
||||
user_id INTEGER NOT NULL,
|
||||
expires_at DATETIME NOT NULL,
|
||||
FOREIGN KEY(user_id) REFERENCES users(id)
|
||||
);
|
||||
Reference in New Issue
Block a user