Add the idempotency key table as an additive migration
Migration 0002 stores one row per accepted message key: the chat, the sender, the key, the SHA-256 fingerprint of the request and the message. The primary key (chat_id, user_id, key) is the key scope of the contract, the composite foreign key keeps the row inside the messaging tables, as messages already do, and CHECK constraints repeat the key format and the fingerprint length. Nothing existing changes, so the lab 2 code keeps running on the new schema. 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
bf0f0b4c07
commit
a18e7b320b
@@ -11,8 +11,8 @@
|
||||
|
||||
## 3. Схема
|
||||
|
||||
- [ ] 3.1 Миграция `0002_idempotency_keys.sql`: PK `(chat_id, user_id, key)`, FK на `chat_members` и `messages`, `CHECK` формата ключа и длины отпечатка
|
||||
- [ ] 3.2 Проверка группы: тест миграций — версии `0001`, `0002`, повтор без изменений, ключ без участника отклоняется FK
|
||||
- [x] 3.1 Миграция `0002_idempotency_keys.sql`: PK `(chat_id, user_id, key)`, FK на `chat_members` и `messages`, `CHECK` формата ключа и длины отпечатка
|
||||
- [x] 3.2 Проверка группы: тест миграций — версии `0001`, `0002`, повтор без изменений, ключ без участника отклоняется FK
|
||||
|
||||
## 4. Идемпотентная отправка (зона `messaging`)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user