Skip to content

Commit

Permalink
feature #227: updated connection string to include the parameters tha…
Browse files Browse the repository at this point in the history
…t are needed to get the mysql working with GORM
  • Loading branch information
IshikaGopie committed Jan 17, 2023
1 parent 25f97e9 commit 0d1a631
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions controllers/rest/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,11 +591,11 @@ func (p *RESTAPI) SQLConnectionFromConfig(config *model.DBConfig) (*sql.DB, *gor

switch config.Driver {
case "mysql":
connStr = fmt.Sprintf("%s:%s@tcp(%s)/%s?tls=true&allowCleartextPasswords=true",
connStr = fmt.Sprintf("%s:%s@tcp(%s)/%s?tls=true&sql_mode='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&allowCleartextPasswords=true&parseTime=true",
dbUser, authenticationToken, dbEndpoint, dbName,
)
case "postgres":
connStr = fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s",
connStr = fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable",
dbHost, dbPort, dbUser, authenticationToken, dbName,
)
default:
Expand Down

0 comments on commit 0d1a631

Please sign in to comment.