PhoenixKitCatalogue.Schemas.ItemSupplierInfo (PhoenixKitCatalogue v0.12.2)

Copy Markdown View Source

Junction table row linking a catalogue item to a supplier.

Each row stores a snapshot of the supplier's name at write time so the record remains readable even when the supplier is later renamed or deleted. A partial unique index enforces at most one primary row per item.

There is intentionally NO uniqueness on (item_uuid, supplier_uuid): multiple rows per supplier are allowed so future price revisions can coexist via valid_from/valid_to windows (planned purchase-price history). The only uniqueness is the partial index on is_primary.

Summary

Types

t()

@type t() :: %PhoenixKitCatalogue.Schemas.ItemSupplierInfo{
  __meta__: term(),
  currency: term(),
  inserted_at: term(),
  is_primary: term(),
  item: term(),
  item_uuid: term(),
  lead_time_days: term(),
  metadata: term(),
  min_order_qty: term(),
  position: term(),
  supplier_name_snapshot: term(),
  supplier_sku: term(),
  supplier_source: term(),
  supplier_uuid: term(),
  unit_cost: term(),
  updated_at: term(),
  uuid: term(),
  valid_from: term(),
  valid_to: term()
}

Functions

changeset(info, attrs)

@spec changeset(t() | Ecto.Changeset.t(t()), map()) :: Ecto.Changeset.t(t())