Added migration

Signed-off-by: Konrad <konrad@kola-entertainments.de>
This commit is contained in:
Konrad Langenberg 2017-09-23 16:19:59 +02:00 committed by Konrad
parent 1b8b2fc17d
commit 8207f32be6
3 changed files with 26 additions and 12 deletions

View File

@ -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 {

View File

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