9 lines
329 B
SQL
9 lines
329 B
SQL
CREATE TABLE message_idempotency (
|
|
sender_id uuid NOT NULL REFERENCES users(id),
|
|
chat_id uuid NOT NULL REFERENCES chats(id),
|
|
key varchar(128) NOT NULL CHECK (key ~ '^[A-Za-z0-9._:-]{1,128}$'),
|
|
message_id uuid NOT NULL REFERENCES messages(id),
|
|
expires_at timestamptz NOT NULL,
|
|
PRIMARY KEY (sender_id, chat_id, key)
|
|
);
|