CREATE TABLE IF NOT EXISTS auth_risk_blocks (
  id TEXT PRIMARY KEY,
  scope_type TEXT NOT NULL,
  scope_key TEXT NOT NULL,
  reason TEXT NOT NULL,
  expires_at TEXT NOT NULL,
  lifted_at TEXT,
  created_at TEXT NOT NULL,
  updated_at TEXT NOT NULL
);

CREATE INDEX IF NOT EXISTS auth_risk_blocks_scope_idx
  ON auth_risk_blocks (scope_type, scope_key, expires_at DESC);
