[MM-42167] Add configuration tables to migration system (#19671)
* add configuration tables to migration system * config: move config migrations into new system completely * add mysql specific bits * use helper db instance instead * fix typo Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
4da27d8e30
Коммит
e49cc0313a
@@ -10,6 +10,7 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/go-sql-driver/mysql"
|
||||
"github.com/mattermost/mattermost-server/v6/model"
|
||||
"github.com/mattermost/mattermost-server/v6/shared/i18n"
|
||||
"github.com/mattermost/mattermost-server/v6/shared/mlog"
|
||||
@@ -261,3 +262,29 @@ func equal(oldCfg, newCfg *model.Config) (bool, error) {
|
||||
}
|
||||
return !bytes.Equal(oldCfgBytes, newCfgBytes), nil
|
||||
}
|
||||
|
||||
// appendMultipleStatementsFlag attached dsn parameters to MySQL dsn in order to make migrations work.
|
||||
func appendMultipleStatementsFlag(dataSource string) (string, error) {
|
||||
|
||||
config, err := mysql.ParseDSN(dataSource)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if config.Params == nil {
|
||||
config.Params = map[string]string{}
|
||||
}
|
||||
|
||||
config.Params["multiStatements"] = "true"
|
||||
return config.FormatDSN(), nil
|
||||
}
|
||||
|
||||
// resetReadTimeout removes the timeout contraint from the MySQL dsn.
|
||||
func resetReadTimeout(dataSource string) (string, error) {
|
||||
config, err := mysql.ParseDSN(dataSource)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
config.ReadTimeout = 0
|
||||
return config.FormatDSN(), nil
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user