forked from mtusi2026/mtusi2026lab4
Реализовать ЛР4: S3-хранилище и вложения на оценку 3
Стенд: PostgreSQL 16 + две API-реплики за HAProxy + SeaweedFS S3 в приватном bucket. Метаданные вложений в PostgreSQL, байты в S3, object key назначает сервер. Лимиты 10 MiB и 40 млн пикселей, MIME по магическим байтам, проверка filename. Добавлены smoke/негативные тесты, хуки restart/stop-one, сценарий отказа S3 и отчёт с доказательствами.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
Table "public.attachments"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------------+--------------------------+-----------+----------+-------------
|
||||
id | uuid | | not null |
|
||||
chat_id | uuid | | not null |
|
||||
owner_id | uuid | | not null |
|
||||
filename | text | | not null |
|
||||
content_type | text | | not null |
|
||||
size_bytes | bigint | | not null |
|
||||
sha256 | text | | not null |
|
||||
object_key | text | | not null |
|
||||
status | text | | not null |
|
||||
variants | jsonb | | not null | '[]'::jsonb
|
||||
error_code | text | | |
|
||||
created_at | timestamp with time zone | | not null |
|
||||
updated_at | timestamp with time zone | | not null |
|
||||
Indexes:
|
||||
"attachments_pkey" PRIMARY KEY, btree (id)
|
||||
"attachments_chat_idx" btree (chat_id)
|
||||
"attachments_object_key_key" UNIQUE CONSTRAINT, btree (object_key)
|
||||
Foreign-key constraints:
|
||||
"attachments_chat_id_fkey" FOREIGN KEY (chat_id) REFERENCES chats(id) ON DELETE CASCADE
|
||||
"attachments_owner_id_fkey" FOREIGN KEY (owner_id) REFERENCES users(id)
|
||||
Referenced by:
|
||||
TABLE "message_attachments" CONSTRAINT "message_attachments_attachment_id_fkey" FOREIGN KEY (attachment_id) REFERENCES attachments(id)
|
||||
|
||||
attachments | object_keys
|
||||
-------------+-------------
|
||||
7 | 7
|
||||
(1 row)
|
||||
|
||||
Reference in New Issue
Block a user