You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
d, err:=database.New(
dbContainer(masterDsn),
&gorm.Config{
NamingStrategy: schema.NamingStrategy{
TablePrefix: prefix, // set prefix to cn_ is correct,but cn is wrong in thisSingularTable: true,
},
Logger: newLogger,
},
database.WithMaxIdleConn(vars.Config.GetInt("database.mysql.minIdleConn")),
database.WithMaxOpenConn(vars.Config.GetInt("database.mysql.maxOpenConn")),
database.WithConnMaxIdleTime(vars.Config.GetDuration("database.mysql.maxIdleTime")*time.Second),
database.WithConnMaxLifetime(vars.Config.GetDuration("database.mysql.maxLifetime")*time.Minute),
)
This parameter cannot be shared with the prefix configured in gorm
If I set prefix to cn_, the table name of gorm concatenation will be determined cn_casbin_rule, but the table name of casbin is cncasbin_rule. Why do I need to concatenate with underscores like this? How can I fix it?
The text was updated successfully, but these errors were encountered:
@chenxi2015 the default behavior should not be modified. You are bringing trouble to all old users and give them incompatibility. Fix the problem by yourself in your code
My code:
getFullTableName code:
My mysql connect code:
This parameter cannot be shared with the
prefix
configured in gormIf I set prefix to
cn_
, the table name of gorm concatenation will be determinedcn_casbin_rule
, but the table name of casbin iscncasbin_rule
. Why do I need to concatenate with underscores like this? How can I fix it?The text was updated successfully, but these errors were encountered: