Video in progress
What problems come up if two services read and write one shared table directly?
The services become tightly coupled through the table structure: if one changes a column, the other breaks on prod. It's unclear who changed which row and why, and independent deployment is lost.
📖 Answer
This happened on one project: notification-service read emails straight from the users table. The user-service team moved the email column to a contacts table. The migration was correct and their tests were green. The notifications silently stopped, because their SQL now returned an empty result.
The problems with a shared table:
- A hidden contract. The table structure effectively becomes an API, but nobody versions it.
- Business rules get bypassed. If
order-servicesets the status straight toPAID, the payment service's checks never run. - Deploying together. Every schema change means coordinating several teams.
- Locks and load. One service's heavy report query slows down another's writes.
The fix is a single owner of the data. If others need it, they call the API or store the copy they need through events.
Sign up to mark studied questions and save your progress.