Files
mtusi2026lab4/migrations/002_idempotency.sql
T
2026-11-06 17:03:03 +03:00

7 lines
311 B
SQL

CREATE TABLE idempotency (
user_id uuid NOT NULL REFERENCES users, chat_id uuid NOT NULL REFERENCES chats,
key varchar(128) NOT NULL, body text NOT NULL, response jsonb NOT NULL,
expires_at timestamptz NOT NULL, PRIMARY KEY(user_id,chat_id,key)
);
CREATE INDEX idempotency_expiry ON idempotency(expires_at);