From 705fe8b5a809257bb87819ab9d12843b722d410a Mon Sep 17 00:00:00 2001 From: Neeraj Gartia Date: Fri, 15 Sep 2023 00:09:41 +0530 Subject: [PATCH] enables translate error property of gorm Signed-off-by: Neeraj Gartia --- pkg/server/infrastructure/datastore/mysql/mysql.go | 1 + pkg/server/infrastructure/datastore/postgres/postgres.go | 1 + 2 files changed, 2 insertions(+) diff --git a/pkg/server/infrastructure/datastore/mysql/mysql.go b/pkg/server/infrastructure/datastore/mysql/mysql.go index 9ccd3419..cfed576a 100644 --- a/pkg/server/infrastructure/datastore/mysql/mysql.go +++ b/pkg/server/infrastructure/datastore/mysql/mysql.go @@ -38,6 +38,7 @@ func New(ctx context.Context, cfg datastore.Config) (datastore.DataStore, error) db, err := gorm.Open(mysqlgorm.Open(cfg.URL), &gorm.Config{ NamingStrategy: sqlnamer.SQLNamer{}, Logger: logger.Default.LogMode(logger.Silent), + TranslateError: true, }) if err != nil { return nil, err diff --git a/pkg/server/infrastructure/datastore/postgres/postgres.go b/pkg/server/infrastructure/datastore/postgres/postgres.go index da65643f..7d527efb 100644 --- a/pkg/server/infrastructure/datastore/postgres/postgres.go +++ b/pkg/server/infrastructure/datastore/postgres/postgres.go @@ -40,6 +40,7 @@ func New(ctx context.Context, cfg datastore.Config) (datastore.DataStore, error) NamingStrategy: sqlnamer.SQLNamer{}, DisableForeignKeyConstraintWhenMigrating: true, Logger: logger.Default.LogMode(logger.Error), + TranslateError: true, }) if err != nil {