forked from mtusi2026/mtusi2026lab5
10 lines
344 B
SQL
10 lines
344 B
SQL
CREATE TABLE message_idempotency (
|
|
user_id uuid NOT NULL REFERENCES users(id),
|
|
chat_id uuid NOT NULL REFERENCES chats(id),
|
|
key text NOT NULL,
|
|
message_id uuid NOT NULL REFERENCES messages(id),
|
|
expires_at timestamptz NOT NULL,
|
|
PRIMARY KEY (user_id,chat_id,key)
|
|
);
|
|
CREATE INDEX message_idempotency_expiry ON message_idempotency(expires_at);
|