Browse Source

migrations: set comment updated as created

Unknwon 3 years ago
parent
commit
bb359a74f1
6 changed files with 25 additions and 4 deletions
  1. 1 1
      README.md
  2. 1 1
      gogs.go
  3. 1 1
      models/issue_comment.go
  4. 3 0
      models/migrations/migrations.go
  5. 18 0
      models/migrations/v14.go
  6. 1 1
      templates/.VERSION

+ 1 - 1
README.md

@@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
3 3
 
4 4
 ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
5 5
 
6
-##### Current tip version: 0.9.86 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions)
6
+##### Current tip version: 0.9.87 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions)
7 7
 
8 8
 | Web | UI  | Preview  |
9 9
 |:-------------:|:-------:|:-------:|

+ 1 - 1
gogs.go

@@ -17,7 +17,7 @@ import (
17 17
 	"github.com/gogits/gogs/modules/setting"
18 18
 )
19 19
 
20
-const APP_VER = "0.9.86.0826"
20
+const APP_VER = "0.9.87.0826"
21 21
 
22 22
 func init() {
23 23
 	runtime.GOMAXPROCS(runtime.NumCPU())

+ 1 - 1
models/issue_comment.go

@@ -358,7 +358,7 @@ func getCommentsByIssueIDSince(e Engine, issueID, since int64) ([]*Comment, erro
358 358
 	comments := make([]*Comment, 0, 10)
359 359
 	sess := e.Where("issue_id = ?", issueID).Asc("created_unix")
360 360
 	if since > 0 {
361
-		sess.And("created_unix >= ?", since)
361
+		sess.And("updated_unix >= ?", since)
362 362
 	}
363 363
 	return comments, sess.Find(&comments)
364 364
 }

+ 3 - 0
models/migrations/migrations.go

@@ -68,6 +68,9 @@ var migrations = []Migration{
68 68
 	NewMigration("generate rands and salt for organizations", generateOrgRandsAndSalt),           // V10 -> V11:v0.8.5
69 69
 	NewMigration("convert date to unix timestamp", convertDateToUnix),                            // V11 -> V12:v0.9.2
70 70
 	NewMigration("convert LDAP UseSSL option to SecurityProtocol", ldapUseSSLToSecurityProtocol), // V12 -> V13:v0.9.37
71
+
72
+	// v13 -> v14:v0.9.87
73
+	NewMigration("set comment updated with created", setCommentUpdatedWithCreated),
71 74
 }
72 75
 
73 76
 // Migrate database to current version

+ 18 - 0
models/migrations/v14.go

@@ -0,0 +1,18 @@
1
+// Copyright 2016 The Gogs Authors. All rights reserved.
2
+// Use of this source code is governed by a MIT-style
3
+// license that can be found in the LICENSE file.
4
+
5
+package migrations
6
+
7
+import (
8
+	"fmt"
9
+
10
+	"github.com/go-xorm/xorm"
11
+)
12
+
13
+func setCommentUpdatedWithCreated(x *xorm.Engine) error {
14
+	if _, err := x.Exec("UPDATE comment SET updated_unix = created_unix"); err != nil {
15
+		return fmt.Errorf("set update_unix: %v", err)
16
+	}
17
+	return nil
18
+}

+ 1 - 1
templates/.VERSION

@@ -1 +1 @@
1
-0.9.86.0826
1
+0.9.87.0826