MM-31356: Add a minimum required version check for Postgres (#16597)

* MM-31356: Add a minimum required version check for Postgres

To keep conformance with our failing fast and obvious philosophy,
we add a check to prevent Mattermost server from starting
if the postgres version is below 10.0.

This gives customers a chance to upgrade their database before upgrading
their Mattermost version, than to run into weird compatibility issues
after they have finished the upgrade.

https://mattermost.atlassian.net/browse/MM-31356

```release-note
NONE
```

* fix lint errors

* Use a function to pretty-print version string

* rectify comment
Этот коммит содержится в:
Agniva De Sarker
2020-12-23 22:06:13 +05:30
коммит произвёл GitHub
родитель 83afd756b6
Коммит c54b262351
8 изменённых файлов: 77 добавлений и 14 удалений

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

@@ -896,7 +896,7 @@ func (ts *TelemetryService) trackServer() {
data["system_admins"] = scr
}
if scr, err := ts.dbStore.GetDbVersion(); err == nil {
if scr, err := ts.dbStore.GetDbVersion(false); err == nil {
data["database_version"] = scr
}

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

@@ -70,7 +70,7 @@ func initializeMocks(cfg *model.Config) (*mocks.ServerIface, *storeMocks.Store,
serverIfaceMock.On("HttpService").Return(httpservice.MakeHTTPService(configService))
storeMock := &storeMocks.Store{}
storeMock.On("GetDbVersion").Return("5.24.0", nil)
storeMock.On("GetDbVersion", false).Return("5.24.0", nil)
systemStore := storeMocks.SystemStore{}
props := model.StringMap{}