mirror of
https://github.com/go-gitea/gitea
synced 2025-12-07 13:28:25 +00:00
merge upstream, resolve migration conflicts
This commit is contained in:
@@ -291,6 +291,8 @@ var migrations = []Migration{
|
||||
// v117 -> v118
|
||||
NewMigration("Add block on rejected reviews branch protection", addBlockOnRejectedReviews),
|
||||
// v118 -> v119
|
||||
NewMigration("Add commit id and stale to reviews", addReviewCommitAndStale),
|
||||
// v119 -> v120
|
||||
NewMigration("add is_restricted column for users table", addIsRestricted),
|
||||
}
|
||||
|
||||
|
||||
@@ -4,14 +4,23 @@
|
||||
|
||||
package migrations
|
||||
|
||||
import "xorm.io/xorm"
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addIsRestricted(x *xorm.Engine) error {
|
||||
// User see models/user.go
|
||||
type User struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
IsRestricted bool `xorm:"NOT NULL DEFAULT false"`
|
||||
func addReviewCommitAndStale(x *xorm.Engine) error {
|
||||
type Review struct {
|
||||
CommitID string `xorm:"VARCHAR(40)"`
|
||||
Stale bool `xorm:"NOT NULL DEFAULT false"`
|
||||
}
|
||||
|
||||
return x.Sync2(new(User))
|
||||
type ProtectedBranch struct {
|
||||
DismissStaleApprovals bool `xorm:"NOT NULL DEFAULT false"`
|
||||
}
|
||||
|
||||
// Old reviews will have commit ID set to "" and not stale
|
||||
if err := x.Sync2(new(Review)); err != nil {
|
||||
return err
|
||||
}
|
||||
return x.Sync2(new(ProtectedBranch))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package migrations
|
||||
|
||||
import "xorm.io/xorm"
|
||||
|
||||
func addIsRestricted(x *xorm.Engine) error {
|
||||
// User see models/user.go
|
||||
type User struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
IsRestricted bool `xorm:"NOT NULL DEFAULT false"`
|
||||
}
|
||||
|
||||
return x.Sync2(new(User))
|
||||
}
|
||||
Reference in New Issue
Block a user