Skip to content

Commit a2cccd3

Browse files
author
Henry Goodman
committed
Remove explicit xorm column names
1 parent 79ee011 commit a2cccd3

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

models/git/protected_branch.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ type ProtectedBranch struct {
4646
MergeWhitelistTeamIDs []int64 `xorm:"JSON TEXT"`
4747
CanForcePush bool `xorm:"NOT NULL DEFAULT false"`
4848
EnableForcePushAllowlist bool `xorm:"NOT NULL DEFAULT false"`
49-
ForcePushAllowlistUserIDs []int64 `xorm:"force_push_allowlist_user_ids JSON TEXT"`
50-
ForcePushAllowlistTeamIDs []int64 `xorm:"force_push_allowlist_team_ids JSON TEXT"`
49+
ForcePushAllowlistUserIDs []int64 `xorm:"JSON TEXT"`
50+
ForcePushAllowlistTeamIDs []int64 `xorm:"JSON TEXT"`
5151
ForcePushAllowlistDeployKeys bool `xorm:"NOT NULL DEFAULT false"`
5252
EnableStatusCheck bool `xorm:"NOT NULL DEFAULT false"`
5353
StatusCheckContexts []string `xorm:"JSON TEXT"`
@@ -552,21 +552,21 @@ func removeIDsFromProtectedBranch(ctx context.Context, p *ProtectedBranch, userI
552552
// RemoveUserIDFromProtectedBranch removes all user ids from protected branch options
553553
func RemoveUserIDFromProtectedBranch(ctx context.Context, p *ProtectedBranch, userID int64) error {
554554
columnNames := []string{
555-
"whitelist_user_ids",
556-
"force_push_whitelist_user_ids",
557-
"merge_whitelist_user_ids",
558-
"approvals_whitelist_user_ids",
555+
"whitelist_user_i_ds",
556+
"force_push_whitelist_user_i_ds",
557+
"merge_whitelist_user_i_ds",
558+
"approvals_whitelist_user_i_ds",
559559
}
560560
return removeIDsFromProtectedBranch(ctx, p, userID, 0, columnNames)
561561
}
562562

563563
// RemoveTeamIDFromProtectedBranch removes all team ids from protected branch options
564564
func RemoveTeamIDFromProtectedBranch(ctx context.Context, p *ProtectedBranch, teamID int64) error {
565565
columnNames := []string{
566-
"whitelist_team_ids",
567-
"force_push_whitelist_team_ids",
568-
"merge_whitelist_team_ids",
569-
"approvals_whitelist_team_ids",
566+
"whitelist_team_i_ds",
567+
"force_push_whitelist_team_i_ds",
568+
"merge_whitelist_team_i_ds",
569+
"approvals_whitelist_team_i_ds",
570570
}
571571
return removeIDsFromProtectedBranch(ctx, p, 0, teamID, columnNames)
572572
}

models/migrations/v1_23/v300.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import "xorm.io/xorm"
77

88
func AddForcePushBranchProtection(x *xorm.Engine) error {
99
type ProtectedBranch struct {
10-
CanForcePush bool `xorm:"NOT NULL DEFAULT false"`
10+
CanForcePush bool `xorm:"NOT NULL DEFAULT false"`
1111
EnableForcePushAllowlist bool
12-
ForcePushAllowlistUserIDs []int64 `xorm:"force_push_allowlist_user_ids JSON TEXT"`
13-
ForcePushAllowlistTeamIDs []int64 `xorm:"force_push_allowlist_team_ids JSON TEXT"`
14-
ForcePushAllowlistDeployKeys bool `xorm:"NOT NULL DEFAULT false"`
12+
ForcePushAllowlistUserIDs []int64 `xorm:"JSON TEXT"`
13+
ForcePushAllowlistTeamIDs []int64 `xorm:"JSON TEXT"`
14+
ForcePushAllowlistDeployKeys bool `xorm:"NOT NULL DEFAULT false"`
1515
}
1616
return x.Sync(new(ProtectedBranch))
1717
}

0 commit comments

Comments
 (0)