Skip to content

Commit b1c5b01

Browse files
bradder555lafriks
authored andcommitted
Fixes 500 error on dashboard when using MSSQL (go-gitea#2504)
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.
1 parent 5b36379 commit b1c5b01

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

models/org.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ func (env *accessibleReposEnv) MirrorRepoIDs() ([]int64, error) {
671671
Table("repository").
672672
Join("INNER", "team_repo", "`team_repo`.repo_id=`repository`.id AND `repository`.is_mirror=?", true).
673673
Where(env.cond()).
674-
GroupBy("`repository`.id").
674+
GroupBy("`repository`.id, `repository`.updated_unix").
675675
OrderBy("updated_unix DESC").
676676
Cols("`repository`.id").
677677
Find(&repoIDs)

0 commit comments

Comments
 (0)