I am in the process of designing a table for a promotion. I can promote three types of entities: article, photo and forum thread.
Initially I thought about creating one table with three foreign keys where only one would be set.
promotion:
- id
- id_article
- id_photo
- id_thread
- promotion_type
- ... other properties
article:
- id
- .. other properties
photo:
- id
- .. other properties
thread:
- id
- .. other properties
Is t a good approach? After initial thoughts it does look like there could be something "prettier" done here. promotion_type
indicates which foreign keys tables should be joined.