Добавил загрузку картинок в S3 и проверку доступа к вложениям

This commit is contained in:
2026-11-17 13:19:43 +03:00
parent ec540a1a72
commit 372471ae58
35 changed files with 2004 additions and 19 deletions
+11
View File
@@ -0,0 +1,11 @@
ALTER TABLE messages DROP CONSTRAINT messages_text_check;
ALTER TABLE messages ADD CONSTRAINT messages_text_check CHECK (char_length(text) <= 4000);
ALTER TABLE messages ADD COLUMN attachment_ids uuid[] NOT NULL DEFAULT '{}';
CREATE TABLE attachments (
id uuid PRIMARY KEY, chat_id uuid NOT NULL REFERENCES chats(id),
uploader_id uuid NOT NULL REFERENCES users(id), object_key text UNIQUE NOT NULL,
filename text NOT NULL, content_type text NOT NULL, size_bytes bigint NOT NULL,
sha256 text NOT NULL, status text NOT NULL CHECK(status IN ('pending','ready')),
created_at timestamptz NOT NULL DEFAULT clock_timestamp()
);
CREATE INDEX attachments_pending_idx ON attachments(created_at) WHERE status='pending';