Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing Customization of Type and ID Column Names for Polymorphic associations #6717

Closed
alexisvisco opened this issue Nov 29, 2023 · 0 comments · Fixed by #6716
Closed

Allowing Customization of Type and ID Column Names for Polymorphic associations #6717

alexisvisco opened this issue Nov 29, 2023 · 0 comments · Fixed by #6716
Assignees
Labels
type:feature_request feature request

Comments

@alexisvisco
Copy link
Contributor

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.

#6716

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature_request feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants