ЛР 5 — асинхронная обработка и версии pipeline

This commit is contained in:
2026-11-16 02:38:13 +03:00
parent 276dbdad8a
commit 1f535f1b5b
163 changed files with 17194 additions and 24 deletions
@@ -0,0 +1,23 @@
-- +goose Up
CREATE TABLE message_idempotency
(
user_id UUID NOT NULL REFERENCES users(id),
chat_id UUID NOT NULL REFERENCES chats(id),
idempotency_key VARCHAR(128) NOT NULL,
message_id UUID NOT NULL REFERENCES messages(id),
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
expires_at TIMESTAMPTZ NOT NULL DEFAULT (now() + interval '24 hours'),
PRIMARY KEY (user_id, chat_id, idempotency_key),
UNIQUE (message_id),
CONSTRAINT message_idempotency_key_format_check
CHECK (idempotency_key COLLATE "C" ~ '^[A-Za-z0-9._:-]{1,128}$'),
CONSTRAINT message_idempotency_expiry_check
CHECK (expires_at > created_at)
);
-- +goose Down
DROP TABLE IF EXISTS message_idempotency;