| @@ -212,6 +212,8 @@ var migrations = []Migration{ | |||||
| NewMigration("Add ResolveDoerID to Comment table", addResolveDoerIDCommentColumn), | NewMigration("Add ResolveDoerID to Comment table", addResolveDoerIDCommentColumn), | ||||
| // v139 -> v140 | // v139 -> v140 | ||||
| NewMigration("prepend refs/heads/ to issue refs", prependRefsHeadsToIssueRefs), | NewMigration("prepend refs/heads/ to issue refs", prependRefsHeadsToIssueRefs), | ||||
| // v140 -> v141 | |||||
| NewMigration("init selected tag", initSelectedTag), | |||||
| } | } | ||||
| // GetCurrentDBVersion returns the current db version | // GetCurrentDBVersion returns the current db version | ||||
| @@ -0,0 +1,31 @@ | |||||
| // Copyright 2019 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 ( | |||||
| "code.gitea.io/gitea/models" | |||||
| "xorm.io/xorm" | |||||
| ) | |||||
| func initSelectedTag(x *xorm.Engine) error { | |||||
| p := &models.OfficialTag{ | |||||
| Code: "Selected", | |||||
| } | |||||
| ok, err := x.Get(p) | |||||
| if ok { | |||||
| return nil | |||||
| } | |||||
| t := &models.OfficialTag{ | |||||
| ID: 1, | |||||
| Code: "Selected", | |||||
| Name: "精选项目", | |||||
| Limit: 9, | |||||
| } | |||||
| _, err = x.Insert(t) | |||||
| return err | |||||
| } | |||||
| @@ -10,6 +10,7 @@ const DefaultOrgTagLimit = -1 | |||||
| type OfficialTag struct { | type OfficialTag struct { | ||||
| ID int64 `xorm:"pk autoincr"` | ID int64 `xorm:"pk autoincr"` | ||||
| Name string `xorm:"NOT NULL"` | Name string `xorm:"NOT NULL"` | ||||
| Code string `xorm:"NOT NULL"` | |||||
| Limit int `xorm:"NOT NULL default(-1)"` | Limit int `xorm:"NOT NULL default(-1)"` | ||||
| CreatedUnix timeutil.TimeStamp `xorm:"created"` | CreatedUnix timeutil.TimeStamp `xorm:"created"` | ||||
| UpdatedUnix timeutil.TimeStamp `xorm:"updated"` | UpdatedUnix timeutil.TimeStamp `xorm:"updated"` | ||||