8 lines
368 B
SQL
8 lines
368 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, body_fingerprint text NOT NULL,
|
|
message_id uuid REFERENCES messages(id), expires_at timestamptz NOT NULL,
|
|
PRIMARY KEY(user_id,chat_id,key)
|
|
);
|
|
CREATE INDEX message_idempotency_expiry_idx ON message_idempotency(expires_at);
|