Added migration
Signed-off-by: Konrad <konrad@kola-entertainments.de>
This commit is contained in:
parent
1b8b2fc17d
commit
8207f32be6
|
|
@ -30,12 +30,6 @@ const(
|
|||
func CreateIssueDependency(user *User, issue, dep *Issue) (exists bool, err error) {
|
||||
sess := x.NewSession()
|
||||
|
||||
// TODO: Move this to the appropriate place
|
||||
err = x.Sync(new(IssueDependency))
|
||||
if err != nil {
|
||||
return exists, err
|
||||
}
|
||||
|
||||
// Check if it aleready exists
|
||||
exists, err = issueDepExists(x, issue.ID, dep.ID)
|
||||
if err != nil {
|
||||
|
|
@ -75,12 +69,6 @@ func CreateIssueDependency(user *User, issue, dep *Issue) (exists bool, err erro
|
|||
func RemoveIssueDependency(user *User, issue *Issue, dep *Issue, depType int64) (err error) {
|
||||
sess := x.NewSession()
|
||||
|
||||
// TODO: Same as above
|
||||
err = x.Sync(new(IssueDependency))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Check if it exists
|
||||
exists, err := issueDepExists(x, issue.ID, dep.ID)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -132,6 +132,8 @@ var migrations = []Migration{
|
|||
NewMigration("migrate protected branch struct", migrateProtectedBranchStruct),
|
||||
// v41 -> v42
|
||||
NewMigration("add default value to user prohibit_login", addDefaultValueToUserProhibitLogin),
|
||||
// v42 -> v43
|
||||
NewMigration("add issue_dependency table", addIssueDependencyTables),
|
||||
}
|
||||
|
||||
// Migrate database to current version
|
||||
|
|
|
|||
24
models/migrations/v42.go
Normal file
24
models/migrations/v42.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2017 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"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
)
|
||||
|
||||
func addIssueDependencyTables(x *xorm.Engine) (err error) {
|
||||
|
||||
err = x.Sync(new(models.IssueDependency))
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error creating issue_dependency_table column definition: %v", err)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user