[MM-41576] Add schema version to the client configuration (#19757)
* revamp db version and add applied migrations endpoint * replace old schema version with new * add db version subcommand * add to local api * reflect review comments * log errors * remove setting the version from model.CurrentVersion * fix a test * use different field for schema version * add build hash and current version to the support packet * add tests * update test to use new assets
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
47c44a9b7d
Коммит
b03d87af40
@@ -20,6 +20,7 @@ import (
|
||||
"os/exec"
|
||||
"path"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
@@ -752,10 +753,10 @@ func (s *Server) Channels() *Channels {
|
||||
return ch
|
||||
}
|
||||
|
||||
// Return Database type (postgres or mysql) and current version of Mattermost
|
||||
func (s *Server) DatabaseTypeAndMattermostVersion() (string, string) {
|
||||
mattermostVersion, _ := s.Store.System().GetByName("Version")
|
||||
return *s.Config().SqlSettings.DriverName, mattermostVersion.Value
|
||||
// Return Database type (postgres or mysql) and current version of the schema
|
||||
func (s *Server) DatabaseTypeAndSchemaVersion() (string, string) {
|
||||
schemaVersion, _ := s.Store.GetDBSchemaVersion()
|
||||
return *s.Config().SqlSettings.DriverName, strconv.Itoa(schemaVersion)
|
||||
}
|
||||
|
||||
// initLogging initializes and configures the logger(s). This may be called more than once.
|
||||
@@ -2194,13 +2195,15 @@ func (a *App) generateSupportPacketYaml() (*model.FileData, string) {
|
||||
vendorName, vendorVersion = ldapInterface.GetVendorNameAndVendorVersion()
|
||||
}
|
||||
|
||||
// Here we are getting information regarding the database (mysql/postgres + current Mattermost version)
|
||||
databaseType, databaseVersion := a.Srv().DatabaseTypeAndMattermostVersion()
|
||||
// Here we are getting information regarding the database (mysql/postgres + current schema version)
|
||||
databaseType, databaseVersion := a.Srv().DatabaseTypeAndSchemaVersion()
|
||||
|
||||
// Creating the struct for support packet yaml file
|
||||
supportPacket := model.SupportPacket{
|
||||
ServerOS: runtime.GOOS,
|
||||
ServerArchitecture: runtime.GOARCH,
|
||||
ServerVersion: model.CurrentVersion,
|
||||
BuildHash: model.BuildHash,
|
||||
DatabaseType: databaseType,
|
||||
DatabaseVersion: databaseVersion,
|
||||
LdapVendorName: vendorName,
|
||||
@@ -2304,3 +2307,11 @@ func runDNDStatusExpireJob(a *App) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (a *App) GetAppliedSchemaMigrations() ([]model.AppliedMigration, *model.AppError) {
|
||||
table, err := a.Srv().Store.GetAppliedMigrations()
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetDBSchemaTable", "api.file.read_file.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
return table, nil
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user