Can I avoid the relationship loop in my database project?

I am trying to create database tables for the case shown below. I also have a specific account, but this is not important in relation to my problem.

There is a list of operations (expenses). Each operation can be performed in the specified POI, places can be grouped in chains (optional). Each operation may have a recipient, in particular a chain of stores.

My current design looks below. I could even delete the chain table in favor of a direct reference to the recipient, but it still leaves a loop between the tables. Effectively, one line can contain links to a place and an account that has a specific recipient.

database design

The only solution I see is checking the table to rule out the described case, but I wonder: is there a better fix?

+4
source share
1 answer

As far as I can tell, there is nothing fundamentally wrong with your design. There is no need to change it just because it contains a loop. The cycle in this case is not even circular dependence. If you think that your current design accurately models what it is intended for, I don’t see the need to change it.

+3
source

Source: https://habr.com/ru/post/1622587/


All Articles