[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 удалений

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

@@ -222,18 +222,48 @@ func (_m *Store) FileInfo() store.FileInfoStore {
return r0
}
// GetCurrentSchemaVersion provides a mock function with given fields:
func (_m *Store) GetCurrentSchemaVersion() string {
// GetAppliedMigrations provides a mock function with given fields:
func (_m *Store) GetAppliedMigrations() ([]model.AppliedMigration, error) {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
var r0 []model.AppliedMigration
if rf, ok := ret.Get(0).(func() []model.AppliedMigration); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
if ret.Get(0) != nil {
r0 = ret.Get(0).([]model.AppliedMigration)
}
}
return r0
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetDBSchemaVersion provides a mock function with given fields:
func (_m *Store) GetDBSchemaVersion() (int, error) {
ret := _m.Called()
var r0 int
if rf, ok := ret.Get(0).(func() int); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(int)
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetDbVersion provides a mock function with given fields: numerical

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

@@ -104,10 +104,13 @@ func (s *Store) UnlockFromMaster() { /* do nothing */ }
func (s *Store) DropAllTables() { /* do nothing */ }
func (s *Store) GetDbVersion(bool) (string, error) { return "", nil }
func (s *Store) RecycleDBConnections(time.Duration) {}
func (s *Store) TotalMasterDbConnections() int { return 1 }
func (s *Store) TotalReadDbConnections() int { return 1 }
func (s *Store) TotalSearchDbConnections() int { return 1 }
func (s *Store) GetCurrentSchemaVersion() string { return "" }
func (s *Store) GetDBSchemaVersion() (int, error) { return 1, nil }
func (s *Store) GetAppliedMigrations() ([]model.AppliedMigration, error) {
return []model.AppliedMigration{}, nil
}
func (s *Store) TotalMasterDbConnections() int { return 1 }
func (s *Store) TotalReadDbConnections() int { return 1 }
func (s *Store) TotalSearchDbConnections() int { return 1 }
func (s *Store) CheckIntegrity() <-chan model.IntegrityCheckResult {
return make(chan model.IntegrityCheckResult)
}