-- Migration: 004_create_tokens
-- Creates the token_revocations table for soft revocation tracking.
-- Supplementary to Redis — provides durability across Redis restarts.

CREATE TABLE IF NOT EXISTS token_revocations (
  jti         UUID        PRIMARY KEY,
  expires_at  TIMESTAMPTZ NOT NULL,
  revoked_at  TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE INDEX IF NOT EXISTS idx_token_revocations_expires_at ON token_revocations (expires_at);
