kgp43
4 months ago

Pivot table for 3 models?

Posted 4 months ago by kgp43

Hi,

I got 3 models: motors, gears and suppliers.

I would like to attach purchase-prices to my products (motors and gears) from a supplier. Any suggestions how to do that?

Can i create some kind of pivot table like this?

motor_id (nullable)
gear_id (nullable)
supplier_id

Also, each product (motor or gear) can have many prices from many suppliers.

Then use motor_id or gear_id when needed (will only be one of them)?

I'm kinda lost for ideas here :(

Please sign in or create an account to participate in this conversation.