Implement lab4 S3 attachments and reliability checks

This commit is contained in:
Polusikkkk
2026-11-05 18:42:22 +03:00
parent ec540a1a72
commit 0f6615dbb9
51 changed files with 6018 additions and 23 deletions
+22
View File
@@ -0,0 +1,22 @@
CREATE TABLE message_idempotency (
user_id UUID NOT NULL REFERENCES users(id),
chat_id UUID NOT NULL REFERENCES chats(id),
http_method TEXT NOT NULL DEFAULT 'POST',
idempotency_key TEXT NOT NULL,
request_text TEXT NOT NULL,
message_id UUID NOT NULL REFERENCES messages(id),
created_at TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp(),
PRIMARY KEY (
user_id, chat_id, http_method, idempotency_key
),
CONSTRAINT message_idempotency_method
CHECK (http_method = 'POST'),
CONSTRAINT message_idempotency_key_format
CHECK (
char_length(idempotency_key) BETWEEN 1 AND 128
AND idempotency_key ~ '^[A-Za-z0-9._:-]+$'
)
);