[MM-41576] Revamp database schema version (#19586)
* 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
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
05503440a6
Коммит
645fee3fe3
@@ -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
|
||||
}
|
||||
|
||||
@@ -173,3 +173,8 @@ type WarnMetricStatus struct {
|
||||
type SendWarnMetricAck struct {
|
||||
ForceAck bool `json:"forceAck"`
|
||||
}
|
||||
|
||||
type AppliedMigration struct {
|
||||
Version int `json:"version"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user