gitea源码

12345678910111213141516171819202122
  1. // Copyright 2024 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package v1_23
  4. import "xorm.io/xorm"
  5. func AddForcePushBranchProtection(x *xorm.Engine) error {
  6. type ProtectedBranch struct {
  7. CanForcePush bool `xorm:"NOT NULL DEFAULT false"`
  8. EnableForcePushAllowlist bool `xorm:"NOT NULL DEFAULT false"`
  9. ForcePushAllowlistUserIDs []int64 `xorm:"JSON TEXT"`
  10. ForcePushAllowlistTeamIDs []int64 `xorm:"JSON TEXT"`
  11. ForcePushAllowlistDeployKeys bool `xorm:"NOT NULL DEFAULT false"`
  12. }
  13. _, err := x.SyncWithOptions(xorm.SyncOptions{
  14. IgnoreConstrains: true,
  15. IgnoreIndices: true,
  16. }, new(ProtectedBranch))
  17. return err
  18. }