Design a polymorphic comments system
A medium Data Modeling interview practice problem on DataDriven. Write and execute real data modeling code with instant grading.
- Domain
- Data Modeling
- Difficulty
- medium
Problem
Design a polymorphic comments system. Instead of separate comment tables per entity, create one comments table that can reference either posts or photos using a commentable_type and commentable_id pattern.
Practice This Problem
Solve this Data Modeling problem with real code execution. DataDriven runs your solution and grades it automatically.