Выполнена лабораторная работа 4

This commit is contained in:
2026-11-16 20:06:52 +03:00
parent ec540a1a72
commit 0cd7200b1f
51 changed files with 2133 additions and 38 deletions
+16
View File
@@ -0,0 +1,16 @@
CREATE TABLE IF NOT EXISTS attachments (
id uuid PRIMARY KEY,
chat_id uuid NOT NULL REFERENCES chats(id),
owner_id uuid NOT NULL REFERENCES users(id),
filename text NOT NULL,
object_key text UNIQUE NOT NULL,
content_type text NOT NULL,
size_bytes bigint NOT NULL,
sha256 text NOT NULL,
status text NOT NULL DEFAULT 'ready',
error_code text,
created_at timestamptz NOT NULL DEFAULT clock_timestamp(),
updated_at timestamptz NOT NULL DEFAULT clock_timestamp()
);
ALTER TABLE messages ADD COLUMN IF NOT EXISTS attachment_ids uuid[] NOT NULL DEFAULT '{}';
CREATE INDEX IF NOT EXISTS attachments_chat ON attachments(chat_id);