[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
Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2022-03-15 16:39:23 +03:00
коммит произвёл GitHub
родитель 47c44a9b7d
Коммит b03d87af40
35 изменённых файлов: 399 добавлений и 50 удалений

Просмотреть файл

@@ -7931,3 +7931,16 @@ func (c *Client4) GetUsersWithInvalidEmails(page, perPage int) ([]*User, *Respon
}
return list, BuildResponse(r), nil
}
func (c *Client4) GetAppliedSchemaMigrations() ([]AppliedMigration, *Response, error) {
r, err := c.DoAPIGet(c.systemRoute()+"/schema/version", "")
if err != nil {
return nil, BuildResponse(r), err
}
defer closeBody(r)
var list []AppliedMigration
if jsonErr := json.NewDecoder(r.Body).Decode(&list); jsonErr != nil {
return nil, nil, NewAppError("GetUsers", "api.unmarshal_error", nil, jsonErr.Error(), http.StatusInternalServerError)
}
return list, BuildResponse(r), nil
}

Просмотреть файл

@@ -79,6 +79,8 @@ type ServerBusyState struct {
type SupportPacket struct {
ServerOS string `yaml:"server_os"`
ServerArchitecture string `yaml:"server_architecture"`
ServerVersion string `yaml:"server_version"`
BuildHash string `yaml:"build_hash,omitempty"`
DatabaseType string `yaml:"database_type"`
DatabaseVersion string `yaml:"database_version"`
LdapVendorName string `yaml:"ldap_vendor_name,omitempty"`
@@ -173,3 +175,8 @@ type WarnMetricStatus struct {
type SendWarnMetricAck struct {
ForceAck bool `json:"forceAck"`
}
type AppliedMigration struct {
Version int `json:"version"`
Name string `json:"name"`
}