Schema Ownership Standard¶
Purpose¶
The Schema Ownership Standard defines how Spring Boot Modulith modules own persistence structures.
Ownership Model¶
| Owner | Responsibility |
|---|---|
| Domain module | Owns source tables, read models, outbox records, and migration files for its facts. |
| Analytics | Owns reporting projections and insight records, not source facts. |
| Intelligence | Owns AI memory records and reasoning data, not operational source facts. |
| Administration | Owns configuration and governance workflow data, not source facts. |
| Shared kernel | Does not own business tables. |
Rules¶
- One table has one owning module.
- A module may reference another module's identifier but must not own the other module's facts.
- Cross-module writes are forbidden.
- Cross-module reads require approved APIs, events, projections, or read contracts.
- Migration ownership follows the owning module.
- Ownership must be visible in future database specs and changelog paths.
Ownership Flow¶
flowchart LR
ModuleA[Owning Module]
TableA[(Owned Tables)]
Event[Domain Event]
ModuleB[Consuming Module]
ProjectionB[(Owned Projection)]
ModuleA --> TableA
ModuleA --> Event
Event --> ModuleB
ModuleB --> ProjectionB
Forbidden Patterns¶
- Shared business tables across modules.
- Generic lookup tables that quietly become a shared dumping ground.
- One module applying migrations to another module's table.
- Analytics projection tables used as operational write targets.
- Intelligence memory used as source-domain data.