Skip to main content

Data Models

The fleet-level view of persistence: which databases exist, which tables each context owns, which of them hold aggregates and which are infrastructure, and where real foreign keys exist. The full entity-relationship diagram for each context, with every column, is on that context's own Entity-Relationship page. Those pages are synced from each repository's develop branch and drawn from its migrations/*.up.sql.

The table names and counts below come from replaying every repository's migrations on origin/develop (CREATE TABLE minus DROP TABLE), and match the synced entity-relationship pages. golang-migrate's own schema_migrations bookkeeping table is excluded from the counts.

Two conventions hold on every page, here and per context:

  1. A relationship line is drawn only where a real FOREIGN KEY exists. No foreign key ever crosses a context boundary. Each context has its own database.
  2. Infrastructure tables are marked. outbox_events, idempotency_keys, processed_events (and their per-consumer variants) and the analytics_* bookkeeping tables implement the transactional outbox, HTTP idempotency and consumer idempotency. They are not domain concepts.
A table is not an aggregate

The Domain Model is the authoritative view of the domain. This page is the persistence shape it is stored in, and the two are deliberately not one-to-one. The domain layer has no knowledge of SQL.

Databases​

Nineteen contexts on this site persist. Eighteen of them have an OLTP database and a separate analytical database, and all eighteen are registered with database: true and an analytics: read side in warehouse-infra develop's terraform/apps.yaml. The nineteenth, outbound-shipping (registered in terraform/apps.yaml with database: true and no analytics: read side, applied to k3s since 2026-11-12), has one Postgres database only: its load_board read model is a table in it, fed by its own analytics topic, and it has no projector or reports binary. The OLTP binary (and its MCP sibling) owns the first. The analytical one is written only by that context's projector binary and read only by its reports binary (see Containers). warehouse-ops-agent has no database at all: its circuit breaker, config and tool-spec cache are in memory (its entity-relationship page explains why).

ContextOLTP tablesAnalytics tablesReal FKs (OLTP)Detailed page
order-management124order_lines and order_promise_groups to ordersER
inventory-storage183stock_units to bins; reservation_allocations to reservations and stock_unitsER
wes-work-planning143work_pool_entries to work_poolsER
fulfillment-execution104noneER
workforce-management84path_plan to shift_plan; labor_assignment_history to labor_assignmentER
facility-layout103eight, along the site, zone, aisle and slot hierarchyER
process-path-management53cpt_schedule_cutoffs to cpt_schedulesER
labor-performance63noneER
network-fulfillment193nine: network_order_lines to network_orders; network_purchase_order_lines and network_labels to network_purchase_orders; network_node_profiles, network_inventory_feeds and network_rejected_listings to network_nodes; inbound_receipts, inbound_receipt_cartons and inbound_receipt_findings to inbound_shipmentsER
warehouse-planning132process_capacity_constraint to process_capacityER
product-master43product_pack_levels to productsER
network-inventory-planning114transfer_audit to inter_warehouse_transferER
inbound-receiving166nine: asn_lines, asn_cartons and receipts to asns; asn_carton_contents to asn_cartons and asn_lines; appointment_asns to appointments; receipt_lines, receipt_cartons and receipt_carton_discrepancies to receiptsER
slotting-optimization132slot_plan_assignments, slot_plan_moves, slot_plan_unassigned and slot_plan_move_executions to slot_plansER
pick-face-replenishment113none: the schema declares no foreign keysER
task-interleaving102three: hints to station_trips, station_trips.current_hint_id to hints, and candidates to hintsER
returns-processing113return_receipt_lines to return_receiptsnone synced yet (its pack has no ER page)
exception-management53noneER
outbound-shipping120 (no analytics database; the load_board table is one of the 12)none: the schema declares no foreign keysER
warehouse-ops-agent00no databaseER
Total19658

Every row was counted on 2026-10-27 from each repository's migrations on origin/develop: the CREATE TABLE minus DROP TABLE statements of every *.up.sql file, split into the OLTP set (migrations/ or internal/adapters/outbound/postgres/migrations/) and the analytics set (migrations/analytics/ or analytics/migrations/), and the FKs from every REFERENCES clause. The totals are the sums of the rows above (OLTP 196, analytics 58). Several synced entity-relationship pages predate their newest migrations and do not show every table counted here: inventory-storage (the container, receipt-booking, packaging and transfer tables), wes-work-planning (slot_plans, product_pack_level_copy), fulfillment-execution (product_classification_copy, interleaving_hints, pack_view), network-fulfillment (the fifteen tables of its live retail-network adapter), warehouse-planning (the three ADR 0017 tables), inbound-receiving (the carton tables, pack_levels and its analytical database), slotting-optimization, network-inventory-planning and pick-face-replenishment (pack_levels), and the analytical tables of task-interleaving and exception-management. Those pages are fixed in their own repositories and re-synced.

Most FKs in the fleet run from a child table to its parent inside one aggregate (an Order and its lines, a WorkPool and its entries, a ProcessCapacity and its constraints, a Product and its pack levels, a ReturnReceipt and its lines). Some contexts also put FKs between separate aggregates or records of their own:

  • facility-layout: Zone to Site, and LocationSlot to Aisle and LocationType. Physical geography is genuinely hierarchical, and the FKs back its no-orphan-slots rule.
  • inventory-storage: stock_units.bin_id to bins, and reservation_allocations.stock_unit_id to stock_units.
  • inbound-receiving: receipts to asns and appointment_asns to appointments, across its three aggregates.
  • network-fulfillment: its live-adapter protocol tables hang off network_nodes, network_purchase_orders and inbound_shipments.
  • task-interleaving: hints to station_trips and back through station_trips.current_hint_id, and candidates to hints. The two aggregates it owns (InterleavingPolicy, StationTrip) reference nothing of each other; the FKs bind a trip to its hints inside the StationTrip aggregate.

fulfillment-execution, labor-performance, pick-face-replenishment, exception-management and outbound-shipping have no FKs at all. Their aggregates reference each other only by identity.

Tables by role​

ContextAggregate stateRead models of other contextsInfrastructure
order-managementorders, order_lines, order_promise_groups; the release-confirmation process-manager state release_confirmations (ADR 0043, empty while RELEASE_CONFIRMATION_MODE=off)planned_capacity_windows (warehouse-planning's CapacityPlan), product_classification_copy (product-master's ProductClassified, ADR 0036)outbox_events, idempotency_keys, repromise_processed_events, planned_capacity_processed_events, product_classification_processed_events, release_confirmation_processed_events
inventory-storagebins, stock_units, reservations, reservation_allocations; containers (the Container aggregate, one sealed case); relocations (the immutable record of each applied move, ADR 0039); bin_sku_levels (the per-bin, per-SKU level version, ADR 0040); the transfer tables transfer_allocations, transfer_receipts, inventory_exceptionsproduct_classifications (a version-guarded copy of product-master's classification since ADR 0034), pack_levels (product-master's pack levels), order_pick_progress (fulfillment-execution's TaskCompleted, ADR 0035), receipt_line_bookings and container_pending_links (what inbound-receiving's receipts booked, and sealed cartons waiting for a booking or a pack level, ADR 0045); the facility location cache is in memoryoutbox_events, idempotency_keys, processed_events
wes-work-planningwork_pools, work_pool_entries, work_units, shift_plans, charge_forecastslabor_plan_view (workforce), usable_inventory_view (inventory), product_classification_copy (product-master, ADR-0035), product_pack_level_copy (product-master's pack levels), slot_plans (the approved slotting plans it applied, so a newer plan supersedes an older one)outbox_events, idempotency_keys, processed_events; events is legacy and unused
fulfillment-executiontasks, stations, packages, order_consolidationsproduct_classification_copy (product-master, ADR-0039), pack_view (product-master's pack levels, ADR 0054), interleaving_hints (task-interleaving's InterleavingHintIssued, ADR 0051); the path catalogue is in memoryoutbox_events, idempotency_keys, processed_events
workforce-managementshift_plan, path_plan, associate_shift, labor_assignment, labor_assignment_historynone (catalogue and performance caches are in memory)outbox_events, idempotency_keys; domain_event is legacy and unused
facility-layoutsites, zones, aisles, cross_aisles, location_slots, location_types, placement_rules, fixed_structuresnone (it consumes nothing)outbox_events, idempotency_keys
process-path-managementprocess_paths, cpt_schedules, cpt_schedule_cutoffsnone (it consumes nothing)outbox_events, idempotency_keys
labor-performancelabor_standards, task_performances, idle_periodsnoneoutbox_events, idempotency_keys, processed_events
network-fulfillmentnetwork_orders, network_order_lines, capability_offers; the protocol state of its live retail-network adapter (ADRs 0026 to 0028): network_nodes, network_purchase_orders, network_purchase_order_lines, network_labels, network_submissions (the submission ledger), network_node_profiles, network_inventory_feeds, network_rejected_listings, inbound_shipments, inbound_poll_cursors, inbound_receiptsinbound_receipt_events, inbound_receipt_cartons, inbound_receipt_findings (inbound-receiving's receipt events for the ASNs it registered), gtin_sku_cache (product-master's GTIN answers); path and capacity caches are in memoryoutbox_events
product-masterproducts and product_pack_levels (the Product aggregate: classification, physical profile and every pack level)noneoutbox_events, processed_events
network-inventory-planninginter_warehouse_transfer, transfer_audit (the immutable audit trail), rebalance_runs; the operator-managed catalogues rebalance_policies and transfer_lanes (ADR 0015)site_capability (facility-layout), site_sku_demand (order-management), published_capacity_plan (warehouse-planning), pack_levels (product-master, ADR 0017)outbox_events, processed_events
warehouse-planningprocess_capacity, process_capacity_constraint, capacity_plans; plus the locally declared process_paths, stored station_standards and operator-declared inbound_labour_standards (ADR 0017)location_slot_registration, location_slot_tally (facility-layout), order_demand (order-management), inbound_appointments (inbound-receiving's dock appointments) and observed_capacity (fulfillment-execution's TaskCompleted), both ADR 0017outbox_events, processed_events
inbound-receivingasns, asn_lines, asn_cartons, asn_carton_contents (Asn), appointments, appointment_asns (DockAppointment), receipts, receipt_lines, receipt_cartons, receipt_carton_discrepancies (Receipt)dock_doors (facility-layout), known_skus (product-master's ProductRegistered), pack_levels (product-master's pack levels)outbox_events, idempotency_keys, processed_events
slotting-optimizationslot_plans, slot_plan_assignments, slot_plan_moves, slot_plan_unassigned (SlotPlan)demand_lines (order-management), product_profiles and pack_levels (product-master), zones and slots (facility-layout), slot_plan_move_executions (inventory-storage's StockRelocated, the execution progress, ADR 0010)outbox_events, idempotency_keys, processed_events
pick-face-replenishmentpolicies (ReplenishmentPolicy), replenishment_requests (ReplenishmentRequest)bin_stock_levels (inventory-storage's bin levels), forward_assignments and forward_assignment_maps (slotting-optimization's SlotPlanApproved, with a stale-map guard), zones and locations (facility-layout), pack_levels (product-master, ADR 0009)outbox_events, idempotency_keys, processed_events
task-interleavinginterleaving_policies (InterleavingPolicy), station_trips, hints and candidates (StationTrip and its hints)task_pool (fulfillment-execution's TaskAvailable, TaskClaimed, TaskCompleted), zones and locations with geometry (facility-layout)outbox_events, idempotency_keys, processed_events
returns-processingreturn_authorizations (ReturnAuthorization), return_receipts and return_receipt_lines (ReturnReceipt), dispositions (Disposition), disposition_policies (the versioned DispositionPolicy)allocated_lines (order-management's allocations), manifested_units (fulfillment-execution's PackageManifested), product_classes (product-master's ProductClassified)outbox, idempotency_keys, processed_events
exception-managementexception_cases (ExceptionCase), exception_policies (one row per ExceptionPolicy version)none: a case keeps a frozen copy of its source payloadoutbox, idempotency_keys, processed_events
outbound-shippingoutbound_loads (OutboundLoad), shipping_packages (ShippingPackage), bills_of_lading (BillOfLading)cpt_schedules (process-path-management's CPTScheduleChanged), zones and locations (facility-layout), dock_appointments (dock-scheduling's DockAppointmentBooked), door_work_completions (yard-management's DoorWorkCompleted), and load_board (its own analytics stream, folded by the analytics consumer)outbox_events, idempotency_keys, processed_events

Patterns that the table makes visible:

  • Every persisting context has a transactional outbox. An aggregate change and the events it raises commit in one transaction to outbox_events (outbox in returns-processing and exception-management), and a relay in the OLTP binary drains them to Kafka. Each domain event becomes one row per destination topic (integration and/or analytics), and every row is a CloudEvents 1.0 structured-mode message.
  • Consumer idempotency is a table wherever a consumer writes state. processed_events (or a per-consumer ledger, as in order-management) is keyed on the inbound CloudEvents id. labor-performance goes one step further and uses that id as the primary key of task_performances.
  • HTTP idempotency. Fifteen of the nineteen persisting contexts store Idempotency-Key replays in an idempotency_keys table: every context in the table above except network-fulfillment, warehouse-planning, product-master and network-inventory-planning. network-fulfillment and warehouse-planning do not implement that middleware (network-fulfillment keeps its own outbound idempotency keys in network_submissions), and product-master needs none: every write is an idempotent PUT. network-inventory-planning keeps its approval idempotency in a unique idempotency_key column on the transfer itself.
  • Event-fed caches often live in memory, not in tables. Process-path catalogues, the facility location cache, the labor-performance cache and path-capacity caches are rebuilt from Kafka at startup. That is why several consumers have no read-model table. See Runtime Flows.

Identity references across contexts​

Cross-context identities are stored as plain TEXT with no constraint, and are never parsed except at one documented seam:

ColumnHoldsOwner of that identity
order_lines.reservation_ida Reservation idinventory-storage
order_lines.path_id, planned_capacity_windows.path_ida process-path idprocess-path-management / warehouse-planning
reservations.demand_refthe order-management demand referenceorder-management
tasks.order_ref, packages.order_ref, order_consolidations.order_refa work_unit_idwes-work-planning
task_performances.task_id, associate_id, task_typetask, associate and task-type idsfulfillment-execution
network_orders.local_order_idan order idorder-management
inter_warehouse_transfer.reservation_id, allocations and stow_allocations (stock_unit_id, bin_id)an inventory-storage reservation and its stock units and binsinventory-storage
product_classifications.sku (inventory-storage), product_classification_copy.sku (order-management, wes-work-planning, fulfillment-execution), product_classes.sku (returns-processing), each with the product's versiona product's SKUproduct-master
allocated_lines, manifested_units and return_authorizations (returns-processing)an order id and line number, and the work unit id {order_id}-line-{line_no}order-management / wes-work-planning

Two seams parse an identity. order-management's re-promise consumer reads orderId and the line number back out of the order_ref (orderId-line-n) carried on TaskCPTMissed and PackageManifested. returns-processing's OrderLineRef builds and parses the same {order_id}-line-{line_no} work unit id, the exact reverse of fulfillment-execution's order_ref, to key its manifest copy by order line. order-management's release-confirmation consumer does not parse: it matches the optional reference and line_no attributes on WorkUnitCreated.

Analytical databases​

Every analytical database has the same shape: report tables, sometimes correlation state, plus projector bookkeeping.

ContextReport table(s)Correlation stateBookkeeping
order-managementfunnel_rollup, repromise_rollupnoneanalytics_processed_events, analytics_consumed_events
inventory-storageflow_accuracy_rollupnonesame two
wes-work-planningthroughput_rollupnonesame two
fulfillment-executionthroughput_rollupanalytics_pending_claimssame two
workforce-managementlabor_rollupanalytics_pending_breakssame two
facility-layoutcatalog_growth_rollupnonesame two
process-path-managementcatalogue_growth_rollupnonesame two
labor-performancelabor_performance_rollupnonesame two
network-fulfillmentacknowledgement_rollupnonesame two
warehouse-planningplan_factsnoneanalytics_processed_events only
product-masterproduct_facts, profile_states (the physical-profile history, read at query time)noneanalytics_processed_events only
network-inventory-planningtransfer_state_advances, transfer_stuck_detections, rebalance_run_facts (append-only facts, aggregated at read time)noneanalytics_processed_events only
inbound-receivingasn_facts, appointment_facts, receipt_facts, receipt_line_events, receipt_discrepanciesnoneanalytics_processed_events only
slotting-optimizationslot_plan_factsnoneanalytics_processed_events only
pick-face-replenishmentreplenishment_facts, policy_declaration_factsnoneanalytics_processed_events only
task-interleavinghint_factsnoneanalytics_processed_events only
returns-processingreturn_line_facts, disposition_factsnoneanalytics_processed_events only
exception-managementexception_case_facts, exception_policy_factsnoneanalytics_processed_events only

outbound-shipping has no analytical database and no row here: its one read model, load_board, lives in its OLTP database.

Table kindPurpose
*_rollup, *_facts, *_events, profile_states, receipt_discrepanciesThe report itself: either pre-aggregated rollups keyed by the dimensions that context reports on, or one row per fact or milestone, aggregated when a report is read.
analytics_pending_*Correlation state for events that must be paired (a claim with its completion, a break start with its end) to compute a duration.
analytics_processed_events / analytics_consumed_eventsIdempotent consumption of the analytics topic, which is delivered at least once like any other.

The report is rebuilt purely from that context's own warehouse.<context>.analytics stream (wes-work-planning's is warehouse.wes.analytics, see Containers), never by a second write from the OLTP side.