Deletion and Retention Semantics
هذا المحتوى غير متوفر بلغتك بعد.
Status — 2026-09-10
Deletion is resource-specific. This page describes the reviewed source, not a
certified production purge policy. The retention period, backup erasure and
external-provider deletion guarantees still require operator confirmation.
No blanket ON DELETE CASCADE change is approved or implemented by this review.
Logical deletion is not physical erasure
Workspace, user and conversation deletion paths generally retain the parent row and mark it deleted. Related messages, usage and audit records can remain. Disabling a connection, archiving a conversation and deleting data are different operations. Do not interpret a successful archive or soft-delete as erasure of provider data, stored blobs or backups.
Dependent records
The schema includes cascades for conversation messages, participants and message assets, and for upstream project sources. These apply to physical deletion of the relevant parent, not merely a status update. Cascading a database row does not itself remove an object-storage blob or a resource at an external provider.
A nullable foreign key still enforces referential integrity for non-null values.
Without SET NULL or explicit cleanup, PostgreSQL normally rejects deletion
of a referenced parent. Nullability does not create orphan rows automatically.
Policy boundaries
- Never cascade deletion from a subscription plan into its workspaces.
- Never cascade workspace or user deletion into all business history by default.
- Never clear a project-routing reference without checking its security and
destination semantics.
NULLmay mean general account space; a blanketSET NULLmigration could silently change where later requests execute. - Physical deletion must consider all references, including archived/deleted records, not only active children.
- Provider-profile cleanup and storage cleanup require coordination with the database transaction; a database rollback cannot undo filesystem deletion.
Before offering a purge guarantee
The operator must approve a per-resource policy covering retention, legal holds, usage/audit records, external-provider effects, object storage and backups. Implement and test explicit dependency conflicts, transaction races, tenant isolation, retries, partial failures and recovery against PostgreSQL. Rehearse migrations and restoration on an authorized disposable environment.
Existing account/project hard-delete paths still need this review. Do not claim that every delete endpoint currently completes cleanly for referenced resources. Use the resource-specific API reference and treat a failed deletion as failed, not as evidence that the data was removed.