Skip to content

Commit c7a6ebf

Browse files
committed
add more cols to avoid wrong columns to be updated
1 parent 16958ae commit c7a6ebf

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

models/activities/notification.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ func SetNotificationStatus(ctx context.Context, notificationID int64, user *user
386386

387387
notification.Status = status
388388

389-
_, err = db.GetEngine(ctx).ID(notificationID).Update(notification)
389+
_, err = db.GetEngine(ctx).ID(notificationID).Cols("status").Update(notification)
390390
return notification, err
391391
}
392392

models/git/branch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ func RenameBranch(ctx context.Context, repo *repo_model.Repository, from, to str
368368
}
369369

370370
// 1. update branch in database
371-
if n, err := sess.Where("repo_id=? AND name=?", repo.ID, from).Update(&Branch{
371+
if n, err := sess.Where("repo_id=? AND name=?", repo.ID, from).Cols("name").Update(&Branch{
372372
Name: to,
373373
}); err != nil {
374374
return err

models/user/must_change_password.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ func SetMustChangePassword(ctx context.Context, all, mustChangePassword bool, in
4545
cond = cond.And(builder.NotIn("lower_name", exclude))
4646
}
4747

48-
return db.GetEngine(ctx).Where(cond).MustCols("must_change_password").Update(&User{MustChangePassword: mustChangePassword})
48+
return db.GetEngine(ctx).Where(cond).Cols("must_change_password").Update(&User{MustChangePassword: mustChangePassword})
4949
}

0 commit comments

Comments
 (0)