# `PhoenixKit.Migrations.Postgres.V103`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.165/lib/phoenix_kit/migrations/postgres/v103.ex#L1)

V103: Nested categories.

Adds a nullable self-referential `parent_uuid` column on
`phoenix_kit_cat_categories`, turning the previously flat one-level
taxonomy into an arbitrary-depth tree. Existing rows stay
`parent_uuid = NULL` and become roots — no backfill needed.

The column is nullable (roots have no parent) with no `ON DELETE`
cascade: parent/child linkage is managed by the context layer, which
runs subtree-walking cascades inside a transaction. A DB-level cascade
would bypass the soft-delete machinery and the activity log.

A plain b-tree index on `(parent_uuid)` covers the "list children"
query used when rendering the tree. The existing index on
`(catalogue_uuid)` still covers "list all categories in a catalogue".

# `down`

Rolls V103 back by dropping the parent index and column.

**Lossy rollback:** the tree collapses — every category becomes a
root and all parent linkage is lost. Back up before rolling back in
production.

# `up`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
