Section §6

Data model

18–22 core entities, full ERD, attribute notes.

6.1 Approach

This section describes the logical data model as observed in the production database. It is grouped by domain rather than by table-name prefix; the same vendor uses several naming conventions across modules and a strict table-by-table reading is harder to comprehend than a domain-by-domain reading.

The model below covers 22 core entities. The full database contains 280+ tables; the remaining ~260 are configuration, lookup, log, and intermediate-staging tables that participate in but do not define the system’s semantics. Their existence is acknowledged in §6.7.

6.2 Entity inventory

#EntityDomainRow count (approx.)Notes
1ItemMaster14 000The central nominal entity. Linked to almost everything.
2CustomerMaster600Includes 80 “dormant” customers (no transactions in 5+ years).
3SupplierMaster280Includes 40 dormant.
4Bill of material (BOM) headerMaster3 200One BOM per manufactured item, mostly. ~150 items have multiple BOMs (versioned).
5BOM lineMaster28 000
6Routing headerMaster1 800
7Routing operationMaster11 500
8Work centreMaster35
9Warehouse / locationMaster12 warehouses, ~180 bin locations
10Customer order headerTransactional480 / week (78 000 lifetime active + closed)
11Customer order lineTransactional1 200 / week
12Production order headerTransactional120 / day (28 000 active + recently-closed)
13Production order line / operationTransactional~360 / day
14Production eventTransactional~2 500 / dayPickup, completion, scrap events.
15Purchase order headerTransactional25 / week
16Purchase order lineTransactional75 / week
17Goods receipt header / lineTransactional30 / day
18Inventory transactionTransactional~3 000 / dayThe system’s audit-of-record for stock movements.
19Supplier invoiceTransactional80 / week
20Sales invoiceTransactional~400 / week
21GL journalTransactional~6 000 / monthOne row per posting line.
22PeriodControl12 / year × 17 years = 204The close-state ledger.

6.3 ERD — core relationships

A compressed entity-relationship summary, focused on cardinality and on the relationships that participate in the highest-traffic queries. denotes “many to one in the direction of the arrow”.

                    ┌───────────────┐
                    │     Item      │◀─────────────────┐
                    │  (14 000)     │                  │
                    └───────┬───────┘                  │
                            │                          │
        ┌───────────────────┼────────────────────┐     │
        │                   │                    │     │
        ▼                   ▼                    ▼     │
   ┌──────────┐      ┌──────────────┐    ┌─────────────┴────┐
   │ BOM line │──┐   │ Routing op   │──┐ │ Cust. order line │
   └──────────┘  │   └──────────────┘  │ └─────────┬────────┘
                 ▼                     ▼           │
            ┌────────────┐    ┌──────────────┐     │
            │ BOM header │    │ Routing hdr  │     │
            │  (3 200)   │    │  (1 800)     │     │
            └─────┬──────┘    └──────┬───────┘     │
                  │                  │             │
                  └────────┬─────────┘             │
                           ▼                       ▼
                  ┌─────────────────┐    ┌────────────────────┐
                  │ Production      │◀───┤ Customer order hdr │
                  │ order header    │    │      (480/wk)      │
                  │  (120/day)      │    └────────────────────┘
                  └────────┬────────┘
                           │
                           ▼
                  ┌─────────────────┐    ┌────────────────────┐
                  │ Production      │    │ Inventory trans    │
                  │ order line/op   │───▶│ (~3 000/day)       │
                  │  (~360/day)     │    └────────────────────┘
                  └────────┬────────┘             ▲
                           │                      │
                           ▼                      │
                  ┌─────────────────┐             │
                  │ Production event│─────────────┘
                  │  (~2 500/day)   │
                  └─────────────────┘

The cardinality pattern is conventional manufacturing ERP. Two relationships warrant explicit note:

  • Item → BOM header is 1:0..n. Most items have zero BOMs (purchased) or one (manufactured). About 150 items have multiple BOMs, distinguished by bom_version. The current_bom_id pointer on the item resolves which is in force; this is enforced at the application layer, not at the database layer. [INF]
  • Production order line → Inventory transaction is 1:n. Each production event of type = completion writes both a production_event row and one or more inventory_transaction rows (one per material consumed plus one for finished output). This double-write is transactional via stored procedure.

6.4 Financial sub-model

   ┌───────────────────┐      ┌──────────────────┐
   │ Customer invoice  │      │ Supplier invoice │
   │  (~400/wk)        │      │   (~80/wk)       │
   └─────────┬─────────┘      └────────┬─────────┘
             │                         │
             └────────────┬────────────┘
                          ▼
                ┌───────────────────┐
                │   GL journal      │
                │  (~6 000/month)   │
                └─────────┬─────────┘
                          │
                          ▼
                ┌───────────────────┐         ┌──────────────────┐
                │     Period        │────────▶│ Statutory report │
                │  (12/yr × 17yr)   │         │   (off-system)   │
                └───────────────────┘         └──────────────────┘

Customer invoices originate from sales (linked back to customer orders and goods issues). Supplier invoices originate from purchasing (linked to PO + GR). Both post to the GL journal. The GL journal is partitioned by period; closed periods are read-only at the database level (enforced by trigger). [DB]

6.5 Master-data integrity

The audit ran targeted integrity queries against the production database. Findings:

CheckExpectedObservedStatus
Items with no BOM and make_or_buy = 'M'08discrepancy — likely setup errors; production blocked when these are ordered. [DB]
Active customers with no transactions in 36 monthsflagged dormant12 (not flagged)drift — dormant-flag housekeeping has not been done since 2022.
Suppliers with no IBAN014These are old cash/cheque suppliers; cannot be paid via bank file. [DB]
Items referenced by closed production orders but no longer in items00OK — soft-delete is honoured.
BOM cycles (item references self transitively)00OK.
Routing operations referencing non-existent work centres03discrepancy — work centre 37, retired in 2020, still referenced by 3 inactive routings. Cosmetic but indicates housekeeping gap.
Customer-order lines with delivery_date IS NULL and status not in ('cancelled','draft')07See §4.4 anomaly — these correspond to operator-edits that should not have been possible.
Inventory transactions with quantity = 001 142Reversal/correction pattern. Not a defect; documented in vendor manual.

6.6 Data-volume profile and growth

The database is approximately 340 GB on disk. By table family:

FamilyApprox. sizeGrowth/yearNotes
Inventory transactions110 GB12 GBLargest table; partitioned by year since 2018.
Production events70 GB8 GBSecond largest.
GL journal35 GB3 GB
Customer / sales invoices28 GB2 GBIncludes printed-invoice PDFs stored in-row [INF, CFG].
Audit / activity log22 GB2.5 GBPurged at 24 months.
Master data4 GB< 100 MB
Crystal Reports definitions3 GB< 50 MB
Other / system~68 GBvariesIncludes a 2018 schema-version copy that was never dropped. [DB]

Annual growth is ~30 GB. The 2018 schema-version copy (~40 GB) is dead weight; dropping it is a Patch-tier action (see §12). The customer’s IT is aware but has not acted because “it works.”

6.7 What lies outside the 22-entity core

The 280-table full schema includes:

  • ~30 configuration tables — application settings, screen-layout overrides, report parameters
  • ~50 lookup / reference tables — unit-of-measure conversions, country codes, currency, VAT rates
  • ~40 staging / intermediate tables for batch jobs (MRP intermediate, period-close worktables)
  • ~80 audit and log tables
  • ~30 integration tables — broker queues, SSIS staging, EDI envelopes
  • ~30 customer-specific tables added by the customer’s IT or by the consultant; these are the highest-risk for modernisation because their semantics live partly in stored procedures and partly in oral tradition

The customer-specific tables are inventoried in Appendix C (see §14).