Polymorphic relation use cases with Laravel – Design Database

I try to design my database and I get confuse.

In my app, an user belong to a group and this group may have multiple stocks of only one type of equipement.

Those stocks can be of two types:

  • Stock of power lines
  • Stock of windturbine

Each stock has an identifier representing the area. Each stock has multiple equipements.

So, to summarize :

User A belongs to group A. Group A has :

  • Windturbine1 which has 5 individual windturbines
  • Windturbines2 which has 10 individual windturbines

User B belongs to group B. Group B has :

  • power_lines1 which has 10 individual powerlines

I tried to represent this scheme like this :

enter image description here

However, I’m not totally convinced. I’m not sure if the stock table need to be polymorphic with windturbine_area and power_line_area.

enter image description here

Any insights on this please ?

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.