-- Admin dashboard: open sign-up invites (independent of a pre-created account)
-- and instance settings that override the config file.
CREATE TABLE signup_invites (
    id         TEXT PRIMARY KEY,
    token_hash TEXT NOT NULL,
    note       TEXT,
    expires_at BIGINT,
    used_at    BIGINT,
    used_by    TEXT REFERENCES users(id) ON DELETE SET NULL,
    created_by TEXT REFERENCES users(id) ON DELETE SET NULL,
    created_at BIGINT NOT NULL
);
CREATE UNIQUE INDEX idx_signup_invites_token ON signup_invites (token_hash);

CREATE TABLE instance_settings (
    key   TEXT PRIMARY KEY,
    value TEXT NOT NULL
);
