add migration
This commit is contained in:
parent
1d74ce335e
commit
79401e39bd
|
@ -186,6 +186,8 @@ var migrations = []Migration{
|
|||
NewMigration("add u2f", addU2FReg),
|
||||
// v66 -> v67
|
||||
NewMigration("add login source id column for public_key table", addLoginSourceIDToPublicKeyTable),
|
||||
// v67 -> v68
|
||||
NewMigration("add visibility for user and org", addVisibilityForUserAndOrg),
|
||||
}
|
||||
|
||||
// Migrate database to current version
|
||||
|
|
22
models/migrations/v67.go
Normal file
22
models/migrations/v67.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2018 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 (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
)
|
||||
|
||||
func addVisibilityForUserAndOrg(x *xorm.Engine) error {
|
||||
type User struct {
|
||||
Visibility int `xorm:"NOT NULL DEFAULT 1"`
|
||||
}
|
||||
|
||||
if err := x.Sync2(new(PublicKey)); err != nil {
|
||||
return fmt.Errorf("Sync2: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
Loading…
Reference in New Issue
Block a user