r/Database • u/No-Security-7518 • 1d ago
How do I reconcile this database schema?
There are 3 projects: 1. ItemGallery. 2. Sender. 3. Receiver. The sender fills a form and creates an item. The item gallery shows it, and the receiver sees it.
The item's data model has a foreign key referencing a sender id. How should I create test items in the gallery project, without declaring the sender's project as a dependency?
0
Upvotes
2
u/NW1969 1d ago
I'm not entirely sure what you are asking, based on the terminology you are using, but if an entity (A) has a FK to another entity (B) , and the FK column is defined as NOT NULL then you can't enter data into A if the corresponding record(s) in B don't exist - that's the whole point of FKs
1
u/Philluminati 1d ago
3 projects with 3 separate code bases? But so toghtly coupled they use the same db? Maybe they could be 3 sub projects of a larger project and share a library that does db handling?
Maybe a good test suite is enough to ensure the theee projects don’t break each other?
Or perhaps they could communicate in a more formal way?
1
u/[deleted] 1d ago
[removed] — view removed comment