Schema foundation
Finance data model
The first implementation phase stores source lineage, canonical entities, aliases, and audit events before any calculation logic is introduced.
Baseline primitives
These tables are safe to build first because they do not encode payout/accounting assumptions.
| Table | Purpose | Close risk |
|---|---|---|
| source_sync_runs | Tracks read-only connector runs, cursors, row counts, and failures. | low risk |
| raw_source_records | Stores source payload hashes so downstream finance numbers can be replayed and audited. | low risk |
| finance_entities | Defines canonical finance identities before aliases and external IDs are approved. | low risk |
| finance_entity_aliases | Maps Rho, Drive, XLSX, Stripe, QBO, and Gravity names to finance entities with review state. | medium risk |
| external_identity_links | Preserves stable external IDs for source-system joins without relying on display names. | low risk |
| finance_audit_events | Append-only record of approvals, overrides, recalculations, and close locks. | low risk |
| month_close_periods | Coordinates close readiness, exception state, approval gates, and eventual lock metadata. | medium risk |
| finance_exceptions | Captures source mismatches, missing approvals, alias conflicts, and reconciliation blockers. | medium risk |
| publisher_contracts | Tracks Drive-sourced publisher agreement documents and their reviewable contract state. | medium risk |
| publisher_contract_terms | Stores extracted publisher terms with human review state before payout calculations can consume them. | high risk |
Next ledger layer
These should be added after source ingestion and alias review are stable.
advertiser_credit_grants
advertiser_funding_ledger
publisher_deposit_ledger
publisher_obligation_ledger
publisher_month_finance_facts