Koovira Dev Docs
90-database/README.md

Database — Data Dictionary & ER

_Live DB: koovira_newmasterdb_opt, MariaDB 10.11.14, 1,797 tables (2026-09-06)._

What's here

row count). Regenerate with the tool below.

  • tables/ — one generated page per table: columns (type/null/key/default/extra),

declared foreign keys, exact dated row count. Generated — never hand-edit.

How to (re)generate

# one module's tables
php developer/docs/_tools/gen_data_dictionary.php 'order%'
php developer/docs/_tools/gen_data_dictionary.php 'kv_order_finance%'

# everything (1,797 pages — large; generate selectively / on a schema-change)
php developer/docs/_tools/gen_data_dictionary.php

Conventions you must know (validated)

  • Primary key is rowId on most tables, not id. (KVGuardedPDO even rewrites a legacy

cm.id → cm.rowId.) Confirm per table.

  • Few declared FK constraints. Relationships are convention-based (buyer_id, company_id,

order_id, …). information_schema FK queries return little — use each module's data-model.md ER map instead, not information_schema.

  • Row counts are snapshots. Quote exact COUNT(*) with a date; information_schema.table_rows

is only an estimate.

  • Empty ≠ unused, and present ≠ canonical. Some tables are dormant alternates (e.g.

order_items = 0 rows while lines live on orders_master). Always confirm the real store.

  • Overflow storage: large text columns may be offloaded to kv_payload_store (gzip, hashed)

and hydrated on read. A NULL text column may not mean "no data" — check kv_payload_store.

  • Polymorphic money key: order money is in kv_order_finance_master/_entries keyed by

(module_key, order_table, order_id) because order IDs collide across modules. See ../40-financial/central-finance-ledger.md.

ER diagrams

Per-module ER lives in each module's data-model.md (Mermaid erDiagram). A master system-level ER is a later deliverable (spec §16 Level 6). Start from the module ERs and the finance-ledger doc.