diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2017-09-25 12:59:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-25 12:59:27 +0800 |
commit | dd55534b82ca9527b68fddf0f63ebb13c105c466 (patch) | |
tree | 5e1398ac3d07da8b7e4cb4fdd52695cea19b62b7 /models/org_team.go | |
parent | 6b6f16cfae5636deb88003fc5b0290450afb4137 (diff) | |
download | gitea-dd55534b82ca9527b68fddf0f63ebb13c105c466.tar.gz gitea-dd55534b82ca9527b68fddf0f63ebb13c105c466.zip |
Reduce usage of allcols on update (#2596)
* reduce usage of allcols on update
* fix bug and tests
Diffstat (limited to 'models/org_team.go')
-rw-r--r-- | models/org_team.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/models/org_team.go b/models/org_team.go index acddc70b58..a9b4fad05b 100644 --- a/models/org_team.go +++ b/models/org_team.go @@ -96,7 +96,7 @@ func (t *Team) addRepository(e Engine, repo *Repository) (err error) { } t.NumRepos++ - if _, err = e.Id(t.ID).AllCols().Update(t); err != nil { + if _, err = e.Id(t.ID).Cols("num_repos").Update(t); err != nil { return fmt.Errorf("update team: %v", err) } @@ -142,7 +142,7 @@ func (t *Team) removeRepository(e Engine, repo *Repository, recalculate bool) (e } t.NumRepos-- - if _, err = e.Id(t.ID).AllCols().Update(t); err != nil { + if _, err = e.Id(t.ID).Cols("num_repos").Update(t); err != nil { return err } @@ -521,7 +521,7 @@ func AddTeamMember(team *Team, userID int64) error { if team.IsOwnerTeam() { ou.IsOwner = true } - if _, err := sess.Id(ou.ID).AllCols().Update(ou); err != nil { + if _, err := sess.Id(ou.ID).Cols("num_teams, is_owner").Update(ou); err != nil { return err } @@ -552,7 +552,7 @@ func removeTeamMember(e Engine, team *Team, userID int64) error { return err } else if _, err = e. Id(team.ID). - AllCols(). + Cols("num_members"). Update(team); err != nil { return err } @@ -579,7 +579,7 @@ func removeTeamMember(e Engine, team *Team, userID int64) error { } if _, err = e. Id(ou.ID). - AllCols(). + Cols("num_teams"). Update(ou); err != nil { return err } |