PR #276 · pramaan-io/pramaan-functions · merged 2026-06-08
Filing type delete was blocked by a ghost reference
A stale matter-type link kept real filing types undeletable
The association was a ghost — the real retention lives in the matter snapshot, not the dropdown.
The fix — Delete guard now checks the only thing that retains a filing type — the matter snapshot.
sequenceDiagram autonumber participant ui as Admin UI participant api as Filing type API participant db as Database ui->>api: DELETE filing type api->>api: Check real retained references only api->>db: Query matter_snapshot_filing_types api->>api: Zero rows → safe to delete api-->>db: Drop the row
| Method | in → out | what it does |
|---|---|---|
upgrade | () → None | Drops the matter_type_filing_types table along with its RLS policies and grants so the stale coupling cannot reappear. |
downgrade | () → None | Restores the association table and its RLS policies and grants if a rollback is ever needed. |
Alembic migration that drops the matter_type_filing_types table and its RLS policies and grants, executing the core decoupling claimed in the PR summary.
| new method | signature |
|---|---|
upgrade | () → None |
downgrade | () → None |
revision : strdown_revision : str | Sequence[str] | Nonebranch_labels : str | Sequence[str] | Nonedepends_on : str | Sequence[str] | None