Skip to content

Commit 59cc58b

Browse files
committed
make mssql work
1 parent 3cf2120 commit 59cc58b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

models/git/protected_branch.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,8 @@ func UpdateProtectBranch(ctx context.Context, repo *repo_model.Repository, prote
420420
// as it's a new rule and if priority was not set, we need to calc it.
421421
if protectBranch.Priority == 0 {
422422
var lowestPrio int64
423-
if _, err := db.GetEngine(ctx).Table(protectBranch).
424-
Select("MAX(priority)").
425-
Where("repo_id = ?", protectBranch.RepoID).
423+
// because of mssql we can not use builder or save xorm syntax, so raw sql it is
424+
if _, err := db.GetEngine(ctx).SQL(`SELECT MAX(priority) FROM protected_branch WHERE repo_id = ?`, protectBranch.RepoID).
426425
Get(&lowestPrio); err != nil {
427426
return err
428427
}

0 commit comments

Comments
 (0)