-- Initial schema for Gitea Notification Hub
-- This file is for documentation purposes; migrations are run programmatically

CREATE TABLE IF NOT EXISTS users (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    gitea_username TEXT UNIQUE,
    gitea_id INTEGER,
    email TEXT UNIQUE,
    full_name TEXT,
    slack_id TEXT,
    slack_name TEXT,
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX IF NOT EXISTS idx_users_email ON users(email);
CREATE INDEX IF NOT EXISTS idx_users_gitea_username ON users(gitea_username);
CREATE INDEX IF NOT EXISTS idx_users_slack_id ON users(slack_id);
