-- 005_create_invites.sql

CREATE TABLE IF NOT EXISTS invites (
    id TEXT PRIMARY KEY,
    document_rkey TEXT NOT NULL,
    token TEXT NOT NULL UNIQUE,
    created_by_did TEXT NOT NULL,
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    expires_at DATETIME NOT NULL
);

CREATE INDEX IF NOT EXISTS idx_invites_document ON invites(document_rkey);
CREATE INDEX IF NOT EXISTS idx_invites_token ON invites(token);
