]> source.dussan.org Git - gitea.git/commitdiff
Fixes 500 error on dashboard when using MSSQL (#2504)
authorbradder555 <bradder555@users.noreply.github.com>
Fri, 15 Sep 2017 06:14:06 +0000 (14:14 +0800)
committerLauris BH <lauris@nix.lv>
Fri, 15 Sep 2017 06:14:06 +0000 (09:14 +0300)
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.

models/org.go

index fd81753931345a4a863d1849628ad14559a70b28..31febe2543f584fc596c7472bd7bac48435751f2 100644 (file)
@@ -680,7 +680,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)