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

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

@@ -236,20 +236,20 @@ func (_m *Store) GetCurrentSchemaVersion() string {
return r0
}
// GetDbVersion provides a mock function with given fields:
func (_m *Store) GetDbVersion() (string, error) {
ret := _m.Called()
// GetDbVersion provides a mock function with given fields: numerical
func (_m *Store) GetDbVersion(numerical bool) (string, error) {
ret := _m.Called(numerical)
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
if rf, ok := ret.Get(0).(func(bool) string); ok {
r0 = rf(numerical)
} else {
r0 = ret.Get(0).(string)
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
if rf, ok := ret.Get(1).(func(bool) error); ok {
r1 = rf(numerical)
} else {
r1 = ret.Error(1)
}

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

@@ -95,7 +95,7 @@ func (s *Store) Close() { /* do nothing */ }
func (s *Store) LockToMaster() { /* do nothing */ }
func (s *Store) UnlockFromMaster() { /* do nothing */ }
func (s *Store) DropAllTables() { /* do nothing */ }
func (s *Store) GetDbVersion() (string, error) { return "", nil }
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 }