ЛР4 - БВТ2302 - Никитина - на 5

This commit is contained in:
Yuliiiaaaa
2026-11-10 13:12:50 +03:00
parent ec540a1a72
commit ae2bd700b5
26 changed files with 1332 additions and 42 deletions
+15
View File
@@ -0,0 +1,15 @@
CREATE TABLE attachments (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
chat_id UUID NOT NULL REFERENCES chats(id) ON DELETE CASCADE,
owner_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
filename VARCHAR(255) NOT NULL,
content_type VARCHAR(100) NOT NULL,
size_bytes BIGINT NOT NULL,
sha256 VARCHAR(64) NOT NULL,
s3_key VARCHAR(512) NOT NULL UNIQUE,
status VARCHAR(20) NOT NULL DEFAULT 'ready',
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
ALTER TABLE messages ADD COLUMN attachment_ids UUID[] DEFAULT '{}';