forked from mtusi2026/mtusi2026lab2
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>