| @@ -0,0 +1,23 @@ | |||||
| package models | |||||
| import ( | |||||
| "code.gitea.io/gitea/modules/timeutil" | |||||
| ) | |||||
| // Issue represents an issue or pull request of repository. | |||||
| type Dataset struct { | |||||
| ID int64 `xorm:"pk autoincr"` | |||||
| Title string `xorm:"INDEX NOT NULL"` | |||||
| Status int32 `xorm:"INDEX"` | |||||
| Category string | |||||
| Description string `xorm:"TEXT"` | |||||
| Download_times int64 | |||||
| License string | |||||
| Task string | |||||
| Release_id int64 `xorm:"INDEX"` | |||||
| User_id int64 `xorm:"INDEX"` | |||||
| CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` | |||||
| UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` | |||||
| Attachments []*Attachment `xorm:"-"` | |||||
| } | |||||
| @@ -212,6 +212,7 @@ 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), | ||||
| NewMigration("add dataset migration", addDatasetTable), | |||||
| } | } | ||||
| // GetCurrentDBVersion returns the current db version | // GetCurrentDBVersion returns the current db version | ||||
| @@ -0,0 +1,34 @@ | |||||
| // 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 ( | |||||
| "fmt" | |||||
| "code.gitea.io/gitea/modules/timeutil" | |||||
| "xorm.io/xorm" | |||||
| ) | |||||
| func addDatasetTable(x *xorm.Engine) error { | |||||
| type Dataset struct { | |||||
| ID int64 `xorm:"pk autoincr"` | |||||
| Title string `xorm:"INDEX NOT NULL"` | |||||
| Status int32 `xorm:"INDEX"` | |||||
| Category string | |||||
| Description string `xorm:"TEXT"` | |||||
| Download_times int64 | |||||
| License string | |||||
| Task string | |||||
| Release_id int64 `xorm:"INDEX"` | |||||
| User_id int64 `xorm:"INDEX"` | |||||
| CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` | |||||
| UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` | |||||
| } | |||||
| if err := x.Sync2(new(Dataset)); err != nil { | |||||
| return fmt.Errorf("Sync2: %v", err) | |||||
| } | |||||
| return nil | |||||
| } | |||||
| @@ -125,6 +125,7 @@ func init() { | |||||
| new(Task), | new(Task), | ||||
| new(LanguageStat), | new(LanguageStat), | ||||
| new(EmailHash), | new(EmailHash), | ||||
| new(Dataset), | |||||
| ) | ) | ||||
| gonicNames := []string{"SSL", "UID"} | gonicNames := []string{"SSL", "UID"} | ||||