From 5754df70e18e256475102f5a17e4598cf2b7c8f4 Mon Sep 17 00:00:00 2001 From: AdamDrewsTR <Adam.Drews@thomsonreuters.com> Date: Thu, 3 Oct 2024 11:23:14 -0500 Subject: [PATCH] Allow session config naming override --- gorm.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gorm.go b/gorm.go index 117d2fd07..21b9d89fe 100644 --- a/gorm.go +++ b/gorm.go @@ -118,6 +118,7 @@ type Session struct { Logger logger.Interface NowFunc func() time.Time CreateBatchSize int + NamingStrategy *schema.NamingStrategy } // Open initialize db session based on dialector @@ -292,6 +293,10 @@ func (db *DB) Session(config *Session) *DB { txConfig.DisableNestedTransaction = true } + if config.NamingStrategy != nil { + txConfig.NamingStrategy = config.NamingStrategy + } + if !config.NewDB { tx.clone = 2 }