Reputation: 1037
I have 2 tables like: And I am using mysql.
1. product
2. template
Now 1 product can have multiple templates associated with it. Which I can achieve by creating a mapping table like:
product_template
Now based on some dynamic condition I need to select a template for the product for each request it is serving for:
Condition like
where I have multiple region in my DB . And to morrow if I want to add another condition that can be done by changes in DB only. Is there any design I should follow to open by DB design extendable.
Upvotes: 0
Views: 37
Reputation: 1490
Instead of the product_id + template_id table you can have a general connection table and add a type, for instance :
template_id external_id type
1 1 'product'
1 2 'product'
1 1 'user'
Then, you can add in this table what you want as type in the future. You just need to rewrite the joins accordingly to the type.
Upvotes: 1