add migration

This commit is contained in:
Gitea 2018-06-08 19:07:54 -04:00
parent 1d74ce335e
commit 79401e39bd
2 changed files with 24 additions and 0 deletions

View File

@ -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
View 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
}