Describe the feature
Allow users to customize the naming conventions for type and id columns when working with polymorphic associations in GORM, specifically for types specified using the gorm:"polymorphic" tag.
Motivation
In scenarios where GORM is integrated with a database migrated by another language or framework, the default naming conventions for type and id columns may not align with the existing database schema. The need for customization becomes apparent, especially for types specified using the gorm:"polymorphic" tag.
The current GORM implementation assumes standard names (<type>_id and <type>_type), making it challenging to seamlessly integrate with databases where these conventions differ. To address this, there is a proposal to enhance GORM, allowing individual users to specify custom type and id column names for any type marked with the gorm:"polymorphic" tag. This enhancement ensures that GORM can adapt to diverse database schemas without risking compatibility issues.
https://github.com/go-gorm/gorm/pull/6716