# `PhoenixKit.Migrations.Postgres.V146`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v2.13.9/lib/phoenix_kit/migrations/postgres/v146.ex#L1)

V146: `primary_supplier_uuid` on catalogue items.

Backs `phoenix_kit_catalogue`'s per-item default supplier (upstream
catalogue commit 2e47cdf): lets an item specify a supplier directly,
independent of manufacturer — needed for generic/unbranded materials
that have no brand to resolve a supplier through, and to break ties
when a manufacturer has more than one linked supplier.

- Nullable `primary_supplier_uuid` FK → `phoenix_kit_cat_suppliers(uuid)`
  with `ON DELETE SET NULL` — the pointer is an optional default; the
  item must survive its supplier (mirrors `category_uuid`'s nilify
  semantics, deliberately NOT `manufacturer_uuid`'s delete_all).
- Partial index on `(primary_supplier_uuid) WHERE NOT NULL` for the
  "items defaulting to this supplier" reverse lookup.

Idempotent + prefix-safe: bare index name on CREATE, all existence
checks schema-anchored, FK constraint checked via `pg_constraint`
anchored to the prefixed table (the V51 idiom).

# `down`

# `up`

---

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