MM-21645: COALESCE(Bots.LastIconUpdate, 0) (#13638)

Handle a potentially `NULL` Bots.LastIconUpdate and `COALESCE` back to `0`. This column has no default, and while v5.20 should never write it as `NULL`, any pre-v5.20 server writing to the new schema will. As a result, this change ensures backwards compatibility.

Fixes: https://mattermost.atlassian.net/browse/MM-21645
Fixes: https://mattermost.atlassian.net/browse/MM-21585
Этот коммит содержится в:
Jesse Hallam
2020-01-17 17:16:18 -04:00
коммит произвёл GitHub
родитель 7d99d8fba7
Коммит 6d79484e55
3 изменённых файлов: 56 добавлений и 37 удалений

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

@@ -91,7 +91,7 @@ func (us SqlBotStore) Get(botUserId string, includeDeleted bool) (*model.Bot, *m
u.FirstName AS DisplayName,
b.Description,
b.OwnerId,
b.LastIconUpdate,
COALESCE(b.LastIconUpdate, 0) AS LastIconUpdate,
b.CreateAt,
b.UpdateAt,
b.DeleteAt
@@ -148,7 +148,7 @@ func (us SqlBotStore) GetAll(options *model.BotGetOptions) ([]*model.Bot, *model
u.FirstName AS DisplayName,
b.Description,
b.OwnerId,
b.LastIconUpdate,
COALESCE(b.LastIconUpdate, 0) AS LastIconUpdate,
b.CreateAt,
b.UpdateAt,
b.DeleteAt

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

@@ -10,5 +10,5 @@ import (
)
func TestBotStore(t *testing.T) {
StoreTest(t, storetest.TestBotStore)
StoreTestWithSqlSupplier(t, storetest.TestBotStore)
}