diff options
author | Gusted <postmaster@gusted.xyz> | 2024-07-15 17:32:36 +0200 |
---|---|---|
committer | Gusted <postmaster@gusted.xyz> | 2024-07-16 23:16:03 +0200 |
commit | 984d0127f169192d1071fc4c4246db3fb1688055 (patch) | |
tree | fc3fc5d7c27bb68d304bc014775ae271d242b67d /models/db | |
parent | Update module github.com/go-testfixtures/testfixtures/v3 to v3.12.0 (diff) | |
download | forgejo-984d0127f169192d1071fc4c4246db3fb1688055.tar.xz forgejo-984d0127f169192d1071fc4c4246db3fb1688055.zip |
Enable multiStatements for MySQL
Diffstat (limited to 'models/db')
-rw-r--r-- | models/db/convert.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/models/db/convert.go b/models/db/convert.go index b8b15382e7..5ebafcf87b 100644 --- a/models/db/convert.go +++ b/models/db/convert.go @@ -6,6 +6,7 @@ package db import ( "fmt" "strconv" + "strings" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" @@ -25,7 +26,8 @@ func ConvertDatabaseTable() error { return err } - _, err = x.Exec(fmt.Sprintf("ALTER DATABASE `%s` CHARACTER SET utf8mb4 COLLATE %s", setting.Database.Name, r.ExpectedCollation)) + databaseName := strings.SplitN(setting.Database.Name, "?", 2)[0] + _, err = x.Exec(fmt.Sprintf("ALTER DATABASE `%s` CHARACTER SET utf8mb4 COLLATE %s", databaseName, r.ExpectedCollation)) if err != nil { return err } |