What problem does it solve?
Many applications need a child model to belong to different parent models, but traditional foreign keys require separate columns per parent type, causing schema bloat and inflexible queries. This skill provides a unified way to model such relationships in GORM.
Core Features & Use Cases
- Unified Owner Columns: Stores both owner ID and owner type in a single table, reducing schema complexity.
- Has‑One and Has‑Many Support: Works for singular and collection associations, e.g., a comment belonging to posts or videos.
- Custom Column Names: Allows overriding default column names and type values for legacy schemas.
- Eager Loading & Association Mode: Preload polymorphic data and manage relationships with GORM’s association API.
- Practical Scenarios: Comment systems, taggable items, address books, and activity feeds where multiple entity types share a common child model.
Quick Start
Ask the skill to configure a polymorphic has‑many relationship between posts and comments.