Re:Death by a Thousand Microservices
by aledalgrande on Tuesday September 12, 2023 @03:43AM
(#37477933)
And then the order table will need to set user ids as a foreign key and you will have two sources of truth lol
Will be fun when you decide that you want to have organizations to be linked to orders instead of users.
All this to say, data management and having more than one source of truth complicates your world a lot. The responsibility for writing the data has to be solved at the appropriate layer: only one entity writing it.
> And then the order table will need to set user ids as a foreign key and you will have two sources of truth lol
Why should your order manager service be tightly-coupled to your IAM service when the only responsibility it has is to store a single ID?
You can't have 42 different classes directly poking the User-table for example. You need one clear location that has the responsibility for the data.
If you move the User-table to a different database schema, other places CANNOT touch it because they won't have access to it =)