Files
mtusi2026lab4/migrations/002_idempotency.sql
T
daniil_sobolev 747ca222e5 Implement lab4 attachments on RustFS for grade 4.
Carry over lab3 HA stack and add private S3 storage, Attachment API, orphan compensation/reaper, own tests, and evidence for smoke/persistence/failover.
2026-11-12 20:41:02 +03:00

16 lines
522 B
SQL

-- Shared idempotency for POST messages across API replicas.
CREATE TABLE IF NOT EXISTS idempotency_keys (
user_id UUID NOT NULL REFERENCES users (id),
method TEXT NOT NULL,
path TEXT NOT NULL,
idem_key TEXT NOT NULL,
request_hash TEXT NOT NULL,
response_status INT NOT NULL,
response_body JSONB NOT NULL,
created_at TIMESTAMPTZ NOT NULL,
PRIMARY KEY (user_id, method, path, idem_key)
);
CREATE INDEX IF NOT EXISTS idempotency_keys_created_at_idx
ON idempotency_keys (created_at);