fix singularize table names

This commit is contained in:
Yavolte 2025-06-12 10:48:10 +08:00
parent 3020468afb
commit e85cc0b8ca
1 changed files with 3 additions and 2 deletions

View File

@ -506,9 +506,10 @@ func AutoMigrate(ctx context.Context, model any, cbs ...Option) (modelValue *Mod
return
}
//路由模块处理
singularizeTable := inflector.Singularize(table)
modelValue = newModel(model, opts.db, types.Naming{
Pluralize: inflector.Pluralize(table),
Singular: inflector.Singularize(table),
Pluralize: inflector.Pluralize(singularizeTable),
Singular: singularizeTable,
ModuleName: opts.moduleName,
TableName: table,
})