Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(database): list every session table a raw delete leaves behind

Yudhi Armyndharis139abe9e35ea
diff --git a/docs/05-database-design.md b/docs/05-database-design.md
index 0e7f1efa3..202553c97 100644
--- a/docs/05-database-design.md
+++ b/docs/05-database-design.md
@@ -305,7 +305,7 @@ erDiagram
}
```
-`messages` and `message_batches` reference `sessions.id` through a plain `sessionId` (`session_id` on `message_batches`) with no foreign key. Deleting a session through the API removes their rows explicitly; a raw `DELETE FROM sessions` leaves them behind.
+Only `webhooks`, `templates`, `automation_rules` and `baileys_stored_messages` declare an `ON DELETE CASCADE` foreign key to `sessions.id`. `messages`, `message_batches`, `chat_states`, `status_updates`, `webhook_outbox_events`, `webhook_delivery_failures` and `integration_delivery_failures` reference it through a plain `sessionId` (`session_id` on `message_batches`) with no foreign key. Deleting a session through the API removes their rows explicitly; a raw `DELETE FROM sessions` leaves them behind.
## 5.3 Table Specifications