tenseleyflow/shithub / c7d158f

Browse files

repos/branch_protection: thread require_signed_commits through upsert+update

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
c7d158f73150945fa011a4aca65bb71f17b74d06
Parents
8d95c1f
Tree
b3b8bbc

2 changed files

StatusFile+-
M internal/repos/queries/branch_protection.sql 3 1
M internal/repos/sqlc/branch_protection.sql.go 7 1
internal/repos/queries/branch_protection.sqlmodified
@@ -27,9 +27,10 @@ WHERE id = $1;
27
 INSERT INTO branch_protection_rules (
27
 INSERT INTO branch_protection_rules (
28
     repo_id, pattern,
28
     repo_id, pattern,
29
     prevent_force_push, prevent_deletion, require_pr_for_push,
29
     prevent_force_push, prevent_deletion, require_pr_for_push,
30
+    require_signed_commits,
30
     allowed_pusher_user_ids, created_by_user_id
31
     allowed_pusher_user_ids, created_by_user_id
31
 ) VALUES (
32
 ) VALUES (
32
-    $1, $2, $3, $4, $5, $6, sqlc.narg(created_by_user_id)::bigint
33
+    $1, $2, $3, $4, $5, sqlc.arg(require_signed_commits)::boolean, $6, sqlc.narg(created_by_user_id)::bigint
33
 )
34
 )
34
 RETURNING id;
35
 RETURNING id;
35
 
36
 
@@ -39,6 +40,7 @@ SET pattern = $2,
39
     prevent_force_push = $3,
40
     prevent_force_push = $3,
40
     prevent_deletion = $4,
41
     prevent_deletion = $4,
41
     require_pr_for_push = $5,
42
     require_pr_for_push = $5,
43
+    require_signed_commits = sqlc.arg(require_signed_commits)::boolean,
42
     allowed_pusher_user_ids = $6
44
     allowed_pusher_user_ids = $6
43
 WHERE id = $1;
45
 WHERE id = $1;
44
 
46
 
internal/repos/sqlc/branch_protection.sql.gomodified
@@ -161,6 +161,7 @@ SET pattern = $2,
161
     prevent_force_push = $3,
161
     prevent_force_push = $3,
162
     prevent_deletion = $4,
162
     prevent_deletion = $4,
163
     require_pr_for_push = $5,
163
     require_pr_for_push = $5,
164
+    require_signed_commits = $7::boolean,
164
     allowed_pusher_user_ids = $6
165
     allowed_pusher_user_ids = $6
165
 WHERE id = $1
166
 WHERE id = $1
166
 `
167
 `
@@ -172,6 +173,7 @@ type UpdateBranchProtectionRuleParams struct {
172
 	PreventDeletion      bool
173
 	PreventDeletion      bool
173
 	RequirePrForPush     bool
174
 	RequirePrForPush     bool
174
 	AllowedPusherUserIds []int64
175
 	AllowedPusherUserIds []int64
176
+	RequireSignedCommits bool
175
 }
177
 }
176
 
178
 
177
 func (q *Queries) UpdateBranchProtectionRule(ctx context.Context, db DBTX, arg UpdateBranchProtectionRuleParams) error {
179
 func (q *Queries) UpdateBranchProtectionRule(ctx context.Context, db DBTX, arg UpdateBranchProtectionRuleParams) error {
@@ -182,6 +184,7 @@ func (q *Queries) UpdateBranchProtectionRule(ctx context.Context, db DBTX, arg U
182
 		arg.PreventDeletion,
184
 		arg.PreventDeletion,
183
 		arg.RequirePrForPush,
185
 		arg.RequirePrForPush,
184
 		arg.AllowedPusherUserIds,
186
 		arg.AllowedPusherUserIds,
187
+		arg.RequireSignedCommits,
185
 	)
188
 	)
186
 	return err
189
 	return err
187
 }
190
 }
@@ -206,9 +209,10 @@ const upsertBranchProtectionRule = `-- name: UpsertBranchProtectionRule :one
206
 INSERT INTO branch_protection_rules (
209
 INSERT INTO branch_protection_rules (
207
     repo_id, pattern,
210
     repo_id, pattern,
208
     prevent_force_push, prevent_deletion, require_pr_for_push,
211
     prevent_force_push, prevent_deletion, require_pr_for_push,
212
+    require_signed_commits,
209
     allowed_pusher_user_ids, created_by_user_id
213
     allowed_pusher_user_ids, created_by_user_id
210
 ) VALUES (
214
 ) VALUES (
211
-    $1, $2, $3, $4, $5, $6, $7::bigint
215
+    $1, $2, $3, $4, $5, $7::boolean, $6, $8::bigint
212
 )
216
 )
213
 RETURNING id
217
 RETURNING id
214
 `
218
 `
@@ -220,6 +224,7 @@ type UpsertBranchProtectionRuleParams struct {
220
 	PreventDeletion      bool
224
 	PreventDeletion      bool
221
 	RequirePrForPush     bool
225
 	RequirePrForPush     bool
222
 	AllowedPusherUserIds []int64
226
 	AllowedPusherUserIds []int64
227
+	RequireSignedCommits bool
223
 	CreatedByUserID      pgtype.Int8
228
 	CreatedByUserID      pgtype.Int8
224
 }
229
 }
225
 
230
 
@@ -231,6 +236,7 @@ func (q *Queries) UpsertBranchProtectionRule(ctx context.Context, db DBTX, arg U
231
 		arg.PreventDeletion,
236
 		arg.PreventDeletion,
232
 		arg.RequirePrForPush,
237
 		arg.RequirePrForPush,
233
 		arg.AllowedPusherUserIds,
238
 		arg.AllowedPusherUserIds,
239
+		arg.RequireSignedCommits,
234
 		arg.CreatedByUserID,
240
 		arg.CreatedByUserID,
235
 	)
241
 	)
236
 	var id int64
242
 	var id int64