Собрать стенд lab4: вложения в MinIO и сверка хранилищ

This commit is contained in:
Wladislava1
2026-11-12 10:57:42 +03:00
parent ec540a1a72
commit 3715c6a395
33 changed files with 3111 additions and 45 deletions
+19
View File
@@ -0,0 +1,19 @@
-- Результат успешного POST сообщения.
-- Область ключа: пользователь + метод + путь чата + Idempotency-Key.
-- Строка пишется в той же транзакции, что и messages, поэтому 5xx
-- не оставляет «занятый» ключ. Другое тело при живом ключе — отказ
-- на уровне приложения (хеш не совпал), без второй строки messages.
CREATE TABLE idempotency_keys (
user_id uuid NOT NULL REFERENCES users (id),
http_method text NOT NULL,
request_path text NOT NULL,
idem_key text NOT NULL,
request_hash text NOT NULL,
message_id uuid NOT NULL REFERENCES messages (id),
created_at timestamptz NOT NULL,
PRIMARY KEY (user_id, http_method, request_path, idem_key),
CONSTRAINT idempotency_method_post CHECK (http_method = 'POST'),
CONSTRAINT idempotency_key_format CHECK (idem_key ~ '^[A-Za-z0-9._:-]{1,128}$'),
CONSTRAINT idempotency_hash_len CHECK (char_length(request_hash) = 64)
);