Skip to main content

infra/sql/0003_idempotency.sql

Metadata

Indexed Symbols

No indexed functions/methods detected in this file.

Markdown Headings (if applicable)

No markdown headings detected.

Source Preview

-- Durable idempotency records for multi-instance gateway behavior.

create table if not exists idempotency_records (
workspace_id uuid not null,
idempotency_key text not null,
route text not null,
method text not null,
status_code integer not null,
response jsonb not null,
created_at timestamptz not null default now(),
expires_at timestamptz not null default (now() + interval '24 hours'),
primary key (workspace_id, idempotency_key, route, method)
);

create index if not exists idx_idempotency_records_expires_at
on idempotency_records(expires_at);