summaryrefslogtreecommitdiffstats
path: root/models/db
diff options
context:
space:
mode:
authorGusted <postmaster@gusted.xyz>2024-07-15 17:32:36 +0200
committerGusted <postmaster@gusted.xyz>2024-07-16 23:16:03 +0200
commit984d0127f169192d1071fc4c4246db3fb1688055 (patch)
treefc3fc5d7c27bb68d304bc014775ae271d242b67d /models/db
parentUpdate module github.com/go-testfixtures/testfixtures/v3 to v3.12.0 (diff)
downloadforgejo-984d0127f169192d1071fc4c4246db3fb1688055.tar.xz
forgejo-984d0127f169192d1071fc4c4246db3fb1688055.zip
Enable multiStatements for MySQL
Diffstat (limited to 'models/db')
-rw-r--r--models/db/convert.go4
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
}