I am lost whileI am working on database design. So I need your help.
It might be simple but I can’t figure it out.
What I want to do is Product and Category relation
Product has 1 category.
Category has many products.
So I can do like this
product = Repo.one(from p in Product, preload: [:category]) product.category.name query = from p in Product, join: c in Category, on: c.name == "Food", select: p
So I can get products that has “Food” category.
Which relation should I use?
one to many?