[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
Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2022-03-08 18:13:37 +03:00
коммит произвёл GitHub
родитель 05503440a6
Коммит 645fee3fe3
37 изменённых файлов: 379 добавлений и 46 удалений

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

@@ -909,3 +909,20 @@ func TestCompleteOnboarding(t *testing.T) {
})
}
func TestGetAppliedSchemaMigrations(t *testing.T) {
th := Setup(t)
defer th.TearDown()
t.Run("as a regular user", func(t *testing.T) {
_, resp, err := th.Client.GetAppliedSchemaMigrations()
require.Error(t, err)
CheckForbiddenStatus(t, resp)
})
th.TestForSystemAdminAndLocal(t, func(t *testing.T, c *model.Client4) {
_, resp, err := c.GetAppliedSchemaMigrations()
require.NoError(t, err)
CheckOKStatus(t, resp)
})
}