summaryrefslogtreecommitdiffstats
path: root/store/sqlstore
diff options
context:
space:
mode:
authorChristian Hoff <hoff.christian@posteo.de>2018-03-01 20:11:44 +0100
committerJoram Wilander <jwawilander@gmail.com>2018-03-01 19:11:44 +0000
commit2b3b6051d265edf131d006b2eb14f55284faf1e5 (patch)
tree2bf50fd4c6ff09daf897f818aaef0c357b67ca79 /store/sqlstore
parent51c7198d53a2fbc4c7d47b3eb308781b69bf4b51 (diff)
downloadchat-2b3b6051d265edf131d006b2eb14f55284faf1e5.tar.gz
chat-2b3b6051d265edf131d006b2eb14f55284faf1e5.tar.bz2
chat-2b3b6051d265edf131d006b2eb14f55284faf1e5.zip
PLT-7567: Integration of Team Icons (#8284)
* PLT-7567: Integration of Team Icons * PLT-7567: Read replica workaround, upgrade logic moved, more concrete i18n key * PLT-7567: Read replica workaround, corrections * PLT-7567: upgrade correction
Diffstat (limited to 'store/sqlstore')
-rw-r--r--store/sqlstore/team_store.go11
-rw-r--r--store/sqlstore/upgrade.go2
2 files changed, 13 insertions, 0 deletions
diff --git a/store/sqlstore/team_store.go b/store/sqlstore/team_store.go
index cddfb7c1a..6528b8e4c 100644
--- a/store/sqlstore/team_store.go
+++ b/store/sqlstore/team_store.go
@@ -99,6 +99,7 @@ func (s SqlTeamStore) Update(team *model.Team) store.StoreChannel {
team.CreateAt = oldTeam.CreateAt
team.UpdateAt = model.GetMillis()
team.Name = oldTeam.Name
+ team.LastTeamIconUpdate = oldTeam.LastTeamIconUpdate
if count, err := s.GetMaster().Update(team); err != nil {
result.Err = model.NewAppError("SqlTeamStore.Update", "store.sql_team.update.updating.app_error", nil, "id="+team.Id+", "+err.Error(), http.StatusInternalServerError)
@@ -559,3 +560,13 @@ func (s SqlTeamStore) RemoveAllMembersByUser(userId string) store.StoreChannel {
}
})
}
+
+func (us SqlTeamStore) UpdateLastTeamIconUpdate(teamId string, curTime int64) store.StoreChannel {
+ return store.Do(func(result *store.StoreResult) {
+ if _, err := us.GetMaster().Exec("UPDATE Teams SET LastTeamIconUpdate = :Time, UpdateAt = :Time WHERE Id = :teamId", map[string]interface{}{"Time": curTime, "teamId": teamId}); err != nil {
+ result.Err = model.NewAppError("SqlTeamStore.UpdateLastTeamIconUpdate", "store.sql_team.update_last_team_icon_update.app_error", nil, "team_id="+teamId, http.StatusInternalServerError)
+ } else {
+ result.Data = teamId
+ }
+ })
+}
diff --git a/store/sqlstore/upgrade.go b/store/sqlstore/upgrade.go
index 77289183c..9cbef233e 100644
--- a/store/sqlstore/upgrade.go
+++ b/store/sqlstore/upgrade.go
@@ -365,8 +365,10 @@ func UpgradeDatabaseToVersion471(sqlStore SqlStore) {
}
func UpgradeDatabaseToVersion48(sqlStore SqlStore) {
+
//TODO: Uncomment the following condition when version 4.8.0 is released
//if shouldPerformUpgrade(sqlStore, VERSION_4_7_0, VERSION_4_8_0) {
+ sqlStore.CreateColumnIfNotExists("Teams", "LastTeamIconUpdate", "bigint", "bigint", "0")
// saveSchemaVersion(sqlStore, VERSION_4_8_0)
//}
}