-- Tracks Authentik OAuth applications provisioned by ultid (idempotent startup).
CREATE TABLE IF NOT EXISTS suite_authentik_provisioned (
    app_key TEXT PRIMARY KEY,
    authentik_slug TEXT NOT NULL,
    client_id TEXT NOT NULL DEFAULT '',
    provider_id INTEGER,
    application_id INTEGER,
    provisioned_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE INDEX IF NOT EXISTS idx_suite_authentik_provisioned_slug
    ON suite_authentik_provisioned (authentik_slug);
