Demo: splitting Shop's shared database
On This Lesson 3 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
separate schemas per service. Prepares MID-025-LAB1.
Draft outline details
Step by step
- Map every table to an owner and list queries that cross owners (for example a join of
ordersandproducts). - Create separate schemas and database users:
orders,inventory,payments. - Replace the cross-owner join with a snapshot in
order_linesand a call toinventory's API for stock. - Migrate data and move Flyway migrations into each service.
- Planned mistake: give
ordersread access "just for reporting" oninventory's table. Show how a column rename in inventory breaks it, then revoke and use an event feed instead. - Document the context map and data ownership table in the repo.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.