PhoenixKit 1.7.180: Database tables for the Warehouse module
PhoenixKit 1.7.180 adds migration V140, which creates the database tables the standalone Warehouse module needs. Nothing reads or writes them yet, so a running site sees no change.
The six tables hold stock, inventory documents, internal orders, supplier orders, goods receipts and goods issues. Stock cannot go below zero, also on installs in a schema of their own. Indexes cover lookups of stock by location and of documents by the order they came from. A few dependencies were updated, among them Ecto, Postgrex and Plug.
Upgrading
Run mix phoenix_kit.update for V140.
Full release notes: PhoenixKit 1.7.180
1.7.180 · 9 July 2026
Added
- V140 migration:
phoenix_kit_warehousetables. Creates the six tables backing the standalonephoenix_kit_warehousepackage —phoenix_kit_warehouse_stock,_inventory_documents,_internal_orders,_supplier_orders,_goods_receipts,_goods_issues. Intra-module FKs are kept (supplier_orders.internal_order_uuid→internal_orders,goods_receipts.supplier_order_uuid→supplier_orders,goods_issues.internal_order_uuid→internal_orders), as isperformed_by_uuid→phoenix_kit_users. The host-specificsub_order_uuidFK is replaced by a genericsource_refsJSONB column resolved through a host-registered callback, so the package depends on no particular “order” concept. Tables ship empty — nothing reads or writes them yet. (#624)
Fixed
- V140
quantity >= 0check was silently skipped on non-publicschemas. The constraint-existence guard matchedpg_constraint.connamealone, but constraint names are unique per(schema, table)— not globally. A second PhoenixKit install into another schema in the same database found the first schema’s constraint, took theIF NOT EXISTSfalse branch, and createdphoenix_kit_warehouse_stockwith no non-negative-quantity check while reporting success. Now scoped withAND conrelid = '<prefixed table>'::regclass, matching V41/V72/V78. (post-merge review) - V140
source_refsreverse lookups were unindexed. Dropping the indexedsub_order_uuidFK column in favour of JSONB removed the index behind “which documents reference this order?”, turning it into a sequential scan. AddedUSING GIN (source_refs)oninternal_orders,supplier_orders,goods_receipts, andgoods_issues. (post-merge review) - V140
phoenix_kit_warehouse_stockcould not be queried by location. Its only index wasUNIQUE (item_uuid, location_uuid), which a composite btree cannot serve for a bareWHERE location_uuid = $1— the most natural query against a stock table, and one every other warehouse table already had an index for. Addedphoenix_kit_warehouse_stock_location_uuid_index. (post-merge review)
Changed
- V140 moduledoc corrected. It justified
item_uuid/location_uuid/storage_folder_uuid/supplier_uuidas FK-less “cross-package references”, but all four targets (phoenix_kit_cat_items,phoenix_kit_locations,phoenix_kit_media_folders,phoenix_kit_cat_suppliers) are created by this same core migration set — V122 already declares an FK onlocation_uuid. The doc now states the truth: an FK is possible, it is omitted pending a delete-semantics decision, and referential integrity for those columns is not enforced by the database. Also genericised the private downstream app’s table names, which were rendering on hexdocs. (post-merge review) - Dependency bumps.
ecto3.14.0 → 3.14.1,postgrex0.22.2 → 0.22.3,plug1.20.2 → 1.20.3,mdex_native0.2.4 → 0.2.5.
PhoenixKit 1.7.180. Install or update: {:phoenix_kit, "~> 1.7"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.