PhoenixKit.Migrations.Postgres.V149 (phoenix_kit v1.7.199)

Copy Markdown View Source

V149: Catalogue item-supplier sourcing info + CRM cross-refs.

Two additive changes that let the phoenix_kit_catalogue plugin carry per-supplier sourcing detail per item and, later, federate those suppliers against CRM — without changing anything warehouse depends on.

The item's scalar primary_supplier_uuid is not created here — it ships upstream in V146 (a hard FK to phoenix_kit_cat_suppliers). This junction is the richer, per-supplier pricing layer alongside it.

phoenix_kit_cat_item_supplier_info

New junction table: one item can be sourced from several suppliers, each with its own SKU, unit cost/currency, lead time, and MOQ. supplier_uuid is a soft ref (no FK) — it resolves to a CRM party or a local cat_supplier; this is where CRM federation actually lands. There is no "primary" among these rows — the item's default supplier is the V146 primary_supplier_uuid scalar (a hard FK to cat_suppliers); this table is purely the per-supplier pricing layer alongside it.

phoenix_kit_cat_suppliers.crm_company_uuid

Nullable UUID soft cross-module xref from a local supplier record to a CRM company, letting a supplier be gradually federated into CRM without losing its catalogue-local identity.

All operations are idempotent.

Summary

Functions

Rolls V149 back by dropping the item-supplier-info table and the supplier CRM xref column, in reverse order.

Functions

down(opts)

Rolls V149 back by dropping the item-supplier-info table and the supplier CRM xref column, in reverse order.

Lossy rollback: all per-supplier item sourcing info (cost, SKU, lead time, CRM links) is lost. Items, suppliers, and the V146 scalar primary_supplier_uuid are untouched.

up(opts)