Skip to content

Commit

Permalink
Fixes 500 error on dashboard when using MSSQL (#2504) (#2662)
Browse files Browse the repository at this point in the history
MSSQL rejects the query:
  SELECT "repository"."id" FROM "repository"
  INNER JOIN "team_repo" ON "team_repo".repo_id="repository".id AND
  "repository".is_mirror=1
  WHERE (
    ("repository".owner_id=2 AND "repository".is_private=0)
        OR team_repo.team_id IN (1)
        )
        GROUP BY "repository".id ORDER BY updated_unix DESC

when the order by term (updated_unix) is not included in the group by
term.
  • Loading branch information
lafriks authored Oct 5, 2017
1 parent 5b36379 commit 73ad7d2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion models/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ func (env *accessibleReposEnv) MirrorRepoIDs() ([]int64, error) {
Table("repository").
Join("INNER", "team_repo", "`team_repo`.repo_id=`repository`.id AND `repository`.is_mirror=?", true).
Where(env.cond()).
GroupBy("`repository`.id").
GroupBy("`repository`.id, `repository`.updated_unix").
OrderBy("updated_unix DESC").
Cols("`repository`.id").
Find(&repoIDs)
Expand Down

0 comments on commit 73ad7d2

Please sign in to comment.