Orphan-Media garbage collection #134

Closed
opened 2026-08-06 15:40:23 +00:00 by rosa · 0 comments
Owner

Orphan-Media garbage collection

Deferred from #131. Media has a lifecycle independent of Posts (ADR-0017 / #131):
removing or replacing a Post's Photo drops the reference but leaves the Media,
and a Media may be referenced by zero Posts. Cascade only fires at the User
boundary (ON DELETE CASCADE). So orphaned Media — never referenced, or left
behind by a Photo removal/replacement — accumulates and is not collected.

Why deferred: safe deletion needs to know a Media isn't referenced by any
Post (and stays that way), which is real bookkeeping; premature hard-delete risks
breaking a still-referenced image. Tolerating orphans keeps deletes safe in v1.

Signal to revisit: orphan volume becoming a meaningful share of DB size, or a
quota (#deferred) needing to reclaim space.

## Orphan-Media garbage collection Deferred from #131. Media has a lifecycle independent of Posts (ADR-0017 / #131): removing or replacing a Post's Photo drops the **reference** but leaves the Media, and a Media may be referenced by zero Posts. Cascade only fires at the **User** boundary (`ON DELETE CASCADE`). So orphaned Media — never referenced, or left behind by a Photo removal/replacement — accumulates and is **not** collected. **Why deferred:** safe deletion needs to know a Media isn't referenced by *any* Post (and stays that way), which is real bookkeeping; premature hard-delete risks breaking a still-referenced image. Tolerating orphans keeps deletes safe in v1. **Signal to revisit:** orphan volume becoming a meaningful share of DB size, or a quota (#deferred) needing to reclaim space.
rosa changed title from Deferred: orphan-Media garbage collection to Orphan-Media garbage collection 2026-08-10 02:17:12 +00:00
rosa closed this issue 2026-08-12 03:53:19 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rosa/vernier#134
No description provided.