Перенесите реализацию ЛР 4 на стенд ЛР 5
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
-- +goose Up
|
||||
-- Keys of POST /chats/{chat_id}/messages: the contract scope user + method +
|
||||
-- chat path + key is (user_id, chat_id, key), as no other endpoint takes keys.
|
||||
CREATE TABLE message_idempotency_keys (
|
||||
user_id uuid NOT NULL,
|
||||
chat_id uuid NOT NULL,
|
||||
key text NOT NULL,
|
||||
message_id uuid NOT NULL,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
PRIMARY KEY (user_id, chat_id, key),
|
||||
FOREIGN KEY (chat_id, message_id) REFERENCES messages (chat_id, id)
|
||||
);
|
||||
|
||||
CREATE INDEX message_idempotency_keys_created_at_idx ON message_idempotency_keys (created_at);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE message_idempotency_keys;
|
||||
Reference in New Issue
Block a user