From e308b103c02b05d5b0ab5b8a6f1ea70321d9f757 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Tue, 30 Jun 2020 07:29:15 +0800 Subject: [PATCH] SingularTable for JoinTable --- schema/naming.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/schema/naming.go b/schema/naming.go index d2a4919f..9b7c9471 100644 --- a/schema/naming.go +++ b/schema/naming.go @@ -41,6 +41,9 @@ func (ns NamingStrategy) ColumnName(table, column string) string { // JoinTableName convert string to join table name func (ns NamingStrategy) JoinTableName(str string) string { + if ns.SingularTable { + return ns.TablePrefix + toDBName(str) + } return ns.TablePrefix + inflection.Plural(toDBName(str)) }