Skip to content

Commit 203557e

Browse files
committed
Ensure Mysql ParseTime to be True
Signed-off-by: RuliXu <[email protected]>
1 parent 5b250f9 commit 203557e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/storage/internalstorage/config.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/jackc/pgx/v4"
1515
"gopkg.in/natefinch/lumberjack.v2"
1616
"gorm.io/gorm/logger"
17+
"k8s.io/klog/v2"
1718
)
1819

1920
const (
@@ -216,9 +217,10 @@ func (cfg *Config) genMySQLConfig() (*mysql.Config, error) {
216217
if cfg.MySQL.InterpolateParams != nil {
217218
mysqlconfig.InterpolateParams = *cfg.MySQL.InterpolateParams
218219
}
219-
if cfg.MySQL.ParseTime != nil {
220-
mysqlconfig.ParseTime = *cfg.MySQL.ParseTime
220+
if cfg.MySQL.ParseTime != nil && !*cfg.MySQL.ParseTime {
221+
klog.Warningln("Mysql query param parseTime=false has been ignored, and set to true")
221222
}
223+
mysqlconfig.ParseTime = true
222224
if cfg.MySQL.RejectReadOnly != nil {
223225
mysqlconfig.RejectReadOnly = *cfg.MySQL.RejectReadOnly
224226
}

0 commit comments

Comments
 (0)