diff options
Diffstat (limited to 'migrations')
| -rw-r--r-- | migrations/004_add_auth.sql | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/migrations/004_add_auth.sql b/migrations/004_add_auth.sql new file mode 100644 index 0000000..065b8e3 --- /dev/null +++ b/migrations/004_add_auth.sql @@ -0,0 +1,20 @@ +-- Authentication tables + +-- Users table +CREATE TABLE IF NOT EXISTS users ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + username TEXT UNIQUE NOT NULL, + password_hash TEXT NOT NULL, + created_at DATETIME DEFAULT CURRENT_TIMESTAMP +); + +CREATE INDEX IF NOT EXISTS idx_users_username ON users(username); + +-- Sessions table (required by scs sqlite3store) +CREATE TABLE IF NOT EXISTS sessions ( + token TEXT PRIMARY KEY, + data BLOB NOT NULL, + expiry REAL NOT NULL +); + +CREATE INDEX IF NOT EXISTS idx_sessions_expiry ON sessions(expiry); |
