Describe the feature
According to https://gorm.io/docs/conventions.html#TableName custom table name for given struct cannot be specified using tag. Would be nice to be able to specify table name with tag in struct definition i.e.
type MyStruct struct {
_ struct{} `gorm:"table:my_table"`
MyField string
}
Motivation
With this solution, it would be easier to use custom table names without touching NamingStrategy where:
- Tabler interface cannot be used (i.e. local structs definitions inside migration func),
- Table() does not work (i.e. with db.Migrator().CreateConstraint())
This would also allow to define custom table names using same solution as for custom column names (tags).
Related Issues
https://github.com/go-gorm/gorm/discussions/6215
Comment From: github-actions[bot]
This issue has been automatically marked as stale because it has been open 360 days with no activity. Remove stale label or comment or this will be closed in 180 days