summaryrefslogtreecommitdiffstats
path: root/models/migrations/v57.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/migrations/v57.go')
-rw-r--r--models/migrations/v57.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/models/migrations/v57.go b/models/migrations/v57.go
new file mode 100644
index 0000000000..3a79a5cca7
--- /dev/null
+++ b/models/migrations/v57.go
@@ -0,0 +1,30 @@
+// 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/modules/util"
+
+ "github.com/go-xorm/xorm"
+)
+
+func addIssueClosedTime(x *xorm.Engine) error {
+ // Issue see models/issue.go
+ type Issue struct {
+ ClosedUnix util.TimeStamp `xorm:"INDEX"`
+ }
+
+ if err := x.Sync2(new(Issue)); err != nil {
+ return fmt.Errorf("Sync2: %v", err)
+ }
+
+ if _, err := x.Exec("UPDATE `issue` SET `closed_unix` = `updated_unix` WHERE `is_closed` = ?", true); err != nil {
+ return err
+ }
+
+ return nil
+}