diff options
Diffstat (limited to 'store/sql_team_store.go')
-rw-r--r-- | store/sql_team_store.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/store/sql_team_store.go b/store/sql_team_store.go index 2784f8630..109fe5401 100644 --- a/store/sql_team_store.go +++ b/store/sql_team_store.go @@ -28,6 +28,7 @@ func NewSqlTeamStore(sqlStore *SqlStore) TeamStore { } func (s SqlTeamStore) UpgradeSchemaIfNeeded() { + s.RemoveColumnIfExists("Teams", "AllowValet") } func (s SqlTeamStore) CreateIndexesIfNotExists() { @@ -49,6 +50,7 @@ func (s SqlTeamStore) Save(team *model.Team) StoreChannel { } team.PreSave() + if result.Err = team.IsValid(); result.Err != nil { storeChannel <- result close(storeChannel) @@ -193,3 +195,23 @@ func (s SqlTeamStore) GetTeamsForEmail(email string) StoreChannel { return storeChannel } + +func (s SqlTeamStore) GetAll() StoreChannel { + storeChannel := make(StoreChannel) + + go func() { + result := StoreResult{} + + var data []*model.Team + if _, err := s.GetReplica().Select(&data, "SELECT * FROM Teams"); err != nil { + result.Err = model.NewAppError("SqlTeamStore.GetAllTeams", "We could not get all teams", err.Error()) + } + + result.Data = data + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} |