forked from mtusi2026/mtusi2026lab4
Стенд: PostgreSQL 16 + две API-реплики за HAProxy + SeaweedFS S3 в приватном bucket. Метаданные вложений в PostgreSQL, байты в S3, object key назначает сервер. Лимиты 10 MiB и 40 млн пикселей, MIME по магическим байтам, проверка filename. Добавлены smoke/негативные тесты, хуки restart/stop-one, сценарий отказа S3 и отчёт с доказательствами.
32 lines
1.7 KiB
Plaintext
32 lines
1.7 KiB
Plaintext
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)
|
|
|