docs: Postgres data model reference + stale schema doc cleanup#2127
docs: Postgres data model reference + stale schema doc cleanup#2127
Conversation
Consolidates the database-per-service plus schema-per-tenant topology into a single reference covering service ownership, tenant isolation mechanism, reference data replication, and the one cross-tenant access pattern. Reflects PR #2125 (public removed from search_path) and PR #2126 (self-service signup). Updates ADR-0003 with a pointer to the new doc and marks the CockroachDB compatibility section as historical. Archives the completed database-per-service migration runbook.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughUpdated tenant routing to use transaction-scoped Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Documentation-only PR, well-verified against the codebase. One non-blocking issue: docs/archive/database-per-service-migration.md has broken relative links to ./incident-response.md and ./disaster-recovery.md (lines 393-394). These files exist in docs/runbooks/ but the file was moved to docs/archive/. Update to ../runbooks/incident-response.md and ../runbooks/disaster-recovery.md. This is what is failing the Link Integrity CI check. Otherwise the PR is solid - all factual claims in the new data-model.md were verified against source code.
Claude Code ReviewCommit: 00e489f | CI: Markdown Lint, Link Integrity, Service Conventions passing; CodeQL, security scanners still running
|
Summary
Adds
docs/architecture/data-model.mdas the consolidated reference for how Meridian stores data in Postgres, and tidies schema docs that drifted after the recent tenant-isolation merges.New doc -
docs/architecture/data-model.mdEnd-to-end reference covering:
org_<id>), withmeridian_platformas the single platform DB for control-plane and tenant servicesservices/tenant/provisioner/postgres_provisioner.goprovisionsorg_<id>schemas, and howshared/platform/db/gorm_tenant_scope.goroutes requests viaSET LOCAL search_pathcmd/meridian/wire_services.go(InstrumentSeeder, SagaSeeder, AccountTypeSeeder, ValuationSeeder, IdentityBootstrap) that replicates platform reference data into each tenant schema on provisioningpublic.tenant_data_entitlementsin market-information) and whyDoc tidy-up
Recent merges that made existing docs partially stale:
publicfromsearch_path, replicating reference data per-tenantChanges:
docs/adr/0003-database-schema-migrations.md- Added a note marking the CockroachDB Compatibility Considerations section as historical (constraints are retained for migration authoring consistency but the runtime is Postgres). Updated the schema-per-org description to reflect the transactionalSET LOCAL search_pathmechanism and PR Remove public from search_path - replicate reference data per-tenant #2125's removal ofpublicfrom the search_path. Cross-linked to the new data-model doc.docs/runbooks/database-per-service-migration.md→docs/archive/- This runbook documented a one-time migration that is now complete. Moved to archive with an updated frontmatter note pointing to the current topology doc.Other stale files (
docs/archive/ARCHITECTURE.md,docs/reports/cockroachdb-migration-audit.md) were already archived or correctly labelled as historical audits, so they are out of scope here.Test plan
services/directoryservices/tenant/provisioner/postgres_provisioner.goandshared/platform/db/gorm_tenant_scope.gogit show 007371ee