19 lines
640 B
SQL
19 lines
640 B
SQL
-- Lab5 ops hardening: durable session revocation + indexes for janitor/replay.
|
|
|
|
CREATE TABLE IF NOT EXISTS session_revocations (
|
|
token_hash TEXT PRIMARY KEY,
|
|
revoked_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
expires_at TIMESTAMPTZ NOT NULL
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_session_revocations_expires
|
|
ON session_revocations (expires_at);
|
|
|
|
-- Attachments may keep staging_key while queued/processing; janitor must see it.
|
|
CREATE INDEX IF NOT EXISTS idx_attachments_staging_key
|
|
ON attachments (staging_key)
|
|
WHERE staging_key IS NOT NULL;
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_attachments_status
|
|
ON attachments (status);
|