You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Postgres data model reference + stale schema doc cleanup (#2127)
* docs: Add Postgres data model reference and tidy stale schema docs
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.
* docs: Update links after archiving database-per-service migration runbook
* docs: Fix relative links in archived database-per-service runbook
---------
Co-authored-by: Ben Coombs <bjcoombs@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/adr/0002-microservices-per-bian-domain.md
+3-7Lines changed: 3 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -667,12 +667,7 @@ GRANT ALL ON DATABASE meridian_current_account TO current_account_svc;
667
667
668
668
### Migration Strategy
669
669
670
-
See [Database-Per-Service Migration Runbook](../runbooks/database-per-service-migration.md) for:
671
-
672
-
- Step-by-step migration guide
673
-
- Rollback procedures
674
-
- Verification checklists
675
-
- Lessons learned
670
+
The initial database-per-service migration is complete. See the [archived migration runbook](../archive/database-per-service-migration.md) for historical context, or the [Data Model Reference](../architecture/data-model.md) for the current topology.
676
671
677
672
### Consequences
678
673
@@ -693,4 +688,5 @@ See [Database-Per-Service Migration Runbook](../runbooks/database-per-service-mi
- Each organization gets its own schema within each service database
158
-
-Connection URL includes `search_path` for org routing: `postgres://...?search_path=org_acme_bank`
158
+
-The search_path is set transactionally via `SET LOCAL search_path TO org_<id>` by `shared/platform/db/gorm_tenant_scope.go`
159
159
- Queries use unqualified table names; PostgreSQL resolves via `search_path`
160
+
- As of PR #2125, `public` is **not** in the search_path — reference data is replicated into each tenant schema on provisioning rather than shared via public. See [data-model.md](../architecture/data-model.md#tenant-isolation-mechanism) for the current mechanism.
160
161
161
162
### Naming Conventions
162
163
@@ -484,7 +485,9 @@ If migrating from golang-migrate:
484
485
* Maintain migration history (no need to replay all migrations)
> **Note:** Meridian now targets PostgreSQL 16 exclusively. The constraints below are retained because existing migrations were authored under CockroachDB compatibility rules and continue to follow them (no PL/pgSQL, split column-add from partial-index-add, explicit timestamp columns instead of range types). New migrations should follow the same conventions for consistency, but the underlying runtime is Postgres. See [data-model.md](../architecture/data-model.md) for the current topology and [docs/reports/cockroachdb-migration-audit.md](../reports/cockroachdb-migration-audit.md) for historical context.
488
491
489
492
While CockroachDB is PostgreSQL-compatible, some PostgreSQL features are **not supported**:
Copy file name to clipboardExpand all lines: docs/archive/database-per-service-migration.md
+9-13Lines changed: 9 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,14 @@
1
1
---
2
2
name: database-per-service-migration
3
-
description: Step-by-step guide for migrating from single shared database to database-per-service architecture
4
-
triggers:
5
-
6
-
- Migrating to database-per-service architecture
7
-
- Setting up new service databases
8
-
- Database isolation for microservices
9
-
- Multi-tenant database setup
3
+
description: "[ARCHIVED] Historical runbook. The database-per-service migration is complete. See docs/architecture/data-model.md for the current topology."
4
+
status: archived
5
+
triggers: []
10
6
11
7
instructions: |
12
-
Create separate database per service following naming convention meridian_<service>.
13
-
Set up schema-per-tenant within each database. Configure dedicated database users
14
-
with restricted grants. Update Atlas configuration per service. Use gRPC for
15
-
cross-service data access instead of SQL joins.
8
+
ARCHIVED. This runbook documented the one-time migration from a shared database
9
+
to database-per-service. That work is complete - every service already owns its
10
+
own Postgres database with schema-per-tenant isolation. For the current topology,
0 commit comments