diff options
author | Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com> | 2017-04-21 13:32:31 +0200 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-04-21 19:32:31 +0800 |
commit | 4bea2191286dd5a9c89696d3e8cd506caf997c7e (patch) | |
tree | 4f720881614581ccfa656a9f61d1a89313e05ceb /models/migrations | |
parent | 52627032bc55bd73694bea9e6e17df575b51664c (diff) | |
download | gitea-4bea2191286dd5a9c89696d3e8cd506caf997c7e.tar.gz gitea-4bea2191286dd5a9c89696d3e8cd506caf997c7e.zip |
Status-API (#1332)
Diffstat (limited to 'models/migrations')
-rw-r--r-- | models/migrations/migrations.go | 2 | ||||
-rw-r--r-- | models/migrations/v29.go | 34 |
2 files changed, 36 insertions, 0 deletions
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index fb7b66cd00..92dd4c8ccd 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -106,6 +106,8 @@ var migrations = []Migration{ NewMigration("change mirror interval from hours to time.Duration", convertIntervalToDuration), // v28 -> v29 NewMigration("add field for repo size", addRepoSize), + // v29 -> v30 + NewMigration("add commit status table", addCommitStatus), } // Migrate database to current version diff --git a/models/migrations/v29.go b/models/migrations/v29.go new file mode 100644 index 0000000000..eadb0f3d87 --- /dev/null +++ b/models/migrations/v29.go @@ -0,0 +1,34 @@ +// Copyright 2017 The Gogs 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" +) + +// CommitStatus see models/status.go +type CommitStatus struct { + ID int64 `xorm:"pk autoincr"` + Index int64 `xorm:"INDEX UNIQUE(repo_sha_index)"` + RepoID int64 `xorm:"INDEX UNIQUE(repo_sha_index)"` + State string `xorm:"VARCHAR(7) NOT NULL"` + SHA string `xorm:"VARCHAR(64) NOT NULL INDEX UNIQUE(repo_sha_index)"` + TargetURL string `xorm:"TEXT"` + Description string `xorm:"TEXT"` + Context string `xorm:"TEXT"` + CreatorID int64 `xorm:"INDEX"` + + CreatedUnix int64 `xorm:"INDEX"` + UpdatedUnix int64 `xorm:"INDEX"` +} + +func addCommitStatus(x *xorm.Engine) error { + if err := x.Sync2(new(CommitStatus)); err != nil { + return fmt.Errorf("Sync2: %v", err) + } + return nil +} |