Best way to set my database models?

I am new to elixir/phoenix and wanted to create a delivery app where a pizza delivery driver can log in and mark orders as complete and the pizza shop staff can log in and view existing orders as well as (customer address, name, etc.).

Here is where I am lost: It can be many pizza shops and a few delivery guys/gals who get assigned to only specific pizza shops (I also want to add functionality to add additional drivers and pizza shops ). When it comes to db models how would I set them? Would it be a many to many or one to many relation? How can I assign drivers to specific pizza shops?

  • I am using PostgreSQL

Thanks for your time!

If there will be less drivers than shops then I would go with many to many, as this gives you flexibility to link them in any way you like.

1 Like