Add the attachments schema as an additive migration
Migration 0003 creates attachments with a pending or ready status, a server-assigned object key in byte order collation and a partial index for pending rows, and message_attachments that keeps the order of the attachments of a message. Foreign keys hold the links between zones: an attachment belongs to a member of its chat, and a message may only reference an attachment of its own chat, with RESTRICT so a referenced attachment can never be deleted. The text check is relaxed to at most 4000 code points because an empty text is legal next to an attachment; an empty message without attachments is still refused by the domain. The migration test covers the new version, a rerun without changes and both foreign keys. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d7fb96bb70
commit
3794df20d4
@@ -1,7 +1,7 @@
|
||||
## 1. Схема
|
||||
|
||||
- [ ] 1.1 Миграция `0003_attachments.sql`: `attachments` (статус `pending`/`ready`, `object_key COLLATE "C"`, `UNIQUE (id, chat_id)`, FK на `chat_members`, частичный индекс `pending`), `message_attachments` (FK на `attachments (id, chat_id)` `ON DELETE RESTRICT`, индекс по `attachment_id`), ослабленный `messages_text_check`
|
||||
- [ ] 1.2 Проверка группы: тест миграций — версия `0003`, повтор без изменений, вложение не участника и ссылка на вложение другого чата отклоняются внешними ключами, пустой текст принимается схемой
|
||||
- [x] 1.1 Миграция `0003_attachments.sql`: `attachments` (статус `pending`/`ready`, `object_key COLLATE "C"`, `UNIQUE (id, chat_id)`, FK на `chat_members`, частичный индекс `pending`), `message_attachments` (FK на `attachments (id, chat_id)` `ON DELETE RESTRICT`, индекс по `attachment_id`), ослабленный `messages_text_check`
|
||||
- [x] 1.2 Проверка группы: тест миграций — версия `0003`, повтор без изменений, вложение не участника и ссылка на вложение другого чата отклоняются внешними ключами, пустой текст принимается схемой
|
||||
|
||||
## 2. Зона `attachments`: домен и приложение
|
||||
|
||||
|
||||
Reference in New Issue
Block a user