diff options
author | 6543 <6543@obermui.de> | 2020-09-05 19:38:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-05 13:38:54 -0400 |
commit | 1ea1cade8559e1d2aa75916c0dbfe31903423101 (patch) | |
tree | bcbf57e73c97b741f2c710804acb0b392fe71e79 /models/migrations | |
parent | 74047864202f2b34ded176597ca0b94034665b52 (diff) | |
download | gitea-1ea1cade8559e1d2aa75916c0dbfe31903423101.tar.gz gitea-1ea1cade8559e1d2aa75916c0dbfe31903423101.zip |
Add Created & Updated to Milestone (#12662)
* Add Created and Updated to Milestone table and expose via API
* Expose to UI - To Overloaded ?!?
* fix unit test
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'models/migrations')
-rw-r--r-- | models/migrations/migrations.go | 2 | ||||
-rw-r--r-- | models/migrations/v149.go | 25 |
2 files changed, 27 insertions, 0 deletions
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 6d27934f6d..aca3891f3d 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -230,6 +230,8 @@ var migrations = []Migration{ NewMigration("create review for 0 review id code comments", createReviewsForCodeComments), // v148 -> v149 NewMigration("remove issue dependency comments who refer to non existing issues", purgeInvalidDependenciesComments), + // v149 -> v150 + NewMigration("Add Created and Updated to Milestone table", addCreatedAndUpdatedToMilestones), } // GetCurrentDBVersion returns the current db version diff --git a/models/migrations/v149.go b/models/migrations/v149.go new file mode 100644 index 0000000000..60c0fae8bc --- /dev/null +++ b/models/migrations/v149.go @@ -0,0 +1,25 @@ +// Copyright 2020 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 addCreatedAndUpdatedToMilestones(x *xorm.Engine) error { + type Milestone struct { + CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` + UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` + } + + if err := x.Sync2(new(Milestone)); err != nil { + return fmt.Errorf("Sync2: %v", err) + } + return nil +} |