Finding a migration boundary in a shared database.
Find a shared database migration boundary by tracing business writes and the invariants they protect. Establish one authoritative writer, classify freshness requirements, and reconcile state before transferring ownership to another service or store.
Inside this article 5 sections +
A shared database migration boundary starts with ownership of business writes, not a list of tables to move. Find the transactions that enforce a business rule, identify every writer, and establish one accountable owner before replacing database access with a network boundary.
Moving a table to another database can reveal dependencies that were previously cheap joins or atomic updates. The safest first step is often to change who may write the data while leaving its physical location unchanged.
Follow one business change through the database
Take an illustrative subscription application. Cancelling a subscription updates the subscription record, changes entitlements, schedules a final invoice, and disables future reminders. A table-oriented migration might assign each table to a different service. A business-oriented investigation asks which effects must be immediate and which may happen later.
Read application code, background jobs, stored procedures, scheduled SQL, and operational scripts. Interview the people who repair records during incidents. Query logs can show observed access, but an unobserved monthly job may still be essential. Capture the evidence window and unresolved writers instead of declaring the inventory complete from a short trace.
Records cancellation and prevents another renewal decision.
Creates or adjusts the final invoice with a retry-safe command.
Stops reminders using a durable cancellation fact.
Classify dependencies by what they protect
A reporting join, a validation read, and a transaction that prevents double spending are not interchangeable dependencies. Reporting can often tolerate a delayed projection. Validation may require an authoritative query or a versioned local view. A cross-table invariant may require the tables to remain under one transactional owner.
For each connection, record the caller, read or write operation, freshness requirement, failure behavior, and business consequence. “Billing reads subscription” is too vague. “Billing renews only if cancellation has not committed” exposes a race that the target architecture must resolve.
A shared database can preserve local transactions and reduce operating overhead, but independent services using it still share schema and runtime constraints. Table ownership makes that coupling visible. Physical separation is useful only when the new consistency and failure model is acceptable.
Choose a transition with one authoritative writer
One option is a compatibility interface around the existing database. Callers stop writing tables directly and invoke the owner instead. The database stays in place while the team observes whether the interface expresses the actual business operations. This is especially useful when undocumented rules are scattered across applications.
A second option creates a read projection in the future service. Change data capture or application events keep it updated while writes remain with the original owner. Consumers test against the projection and measure freshness. This can remove expensive joins without pretending the new service already owns the business process.
A third option transfers write ownership after a backfill and catch-up phase. Route commands through a controlled boundary, stop conflicting writers, reconcile the final changes, and then activate the new owner. Avoid an indefinite period in which both systems independently accept writes and a background script tries to guess which version is correct.
Define reconciliation before the first backfill
Record a consistent snapshot position and the changes required after that point. Compare keys, meaningful state, and business totals, not only row counts. Two databases can contain the same number of subscriptions while disagreeing about which ones are cancelled. Define how deletions, corrections, and out-of-order updates are represented.
Use version information or another ordering rule where a late update could overwrite a newer state. Make replay idempotent, and retain enough source evidence to explain a mismatch. A migration pipeline should expose the oldest unapplied change and unresolved conflicts, not merely a green “job completed” status.
Keep sensitive fields out of ad hoc comparison files where aggregate or hashed checks suffice. Operators still need a controlled way to inspect specific mismatches. The validation design should make that access deliberate rather than forcing engineers to export entire customer tables.
Watch for administrative exports and support dashboards that still query the old tables after application traffic moves. Give those consumers a replacement contract and a deadline. A migration remains operationally coupled while an essential repair tool depends on the supposedly retired schema.
Prove the boundary with a failure exercise
Pause the projection consumer, submit a cancellation, and inspect every user-visible outcome. Then restart the consumer twice. Verify that entitlements follow the agreed freshness rule, invoices are not duplicated, and reminders do not resume because an older event arrived late. This exercise tests the ownership contract under conditions that a successful backfill cannot cover.
Use the architecture review to establish the dependency inventory, then apply the strangler rollback exercise when traffic moves. Architecture design should leave the team with a named writer, explicit invariants, and a transition that can be observed and reversed within its stated limits.