forked from mtusi2026/mtusi2026lab4
Добавил загрузку картинок в S3 и проверку доступа к вложениям
This commit is contained in:
@@ -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';
|
||||
Reference in New Issue
Block a user