summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorMarin Jankovski <maxlazio@gmail.com>2016-03-11 12:43:35 +0100
committerMarin Jankovski <maxlazio@gmail.com>2016-03-11 12:43:35 +0100
commit1314ba219ef8a655872df743434bffe959d3028f (patch)
tree9ee81ef7fb5901aefb5c28d8ae09e55bbf9121b5 /models
parent5267dce21023802818b0c0c16ba2ca47c146e1b5 (diff)
downloadgitea-1314ba219ef8a655872df743434bffe959d3028f.tar.gz
gitea-1314ba219ef8a655872df743434bffe959d3028f.zip
Updated and created were appended with _unix. Fresh databases have only the newly named fields.
Diffstat (limited to 'models')
-rw-r--r--models/access.go2
-rw-r--r--models/issue.go8
-rw-r--r--models/issue_comment.go2
-rw-r--r--models/release.go2
-rw-r--r--models/repo.go5
5 files changed, 10 insertions, 9 deletions
diff --git a/models/access.go b/models/access.go
index fe2350606a..447777ad5a 100644
--- a/models/access.go
+++ b/models/access.go
@@ -110,7 +110,7 @@ func (u *User) GetAccessibleRepositories() ([]*Repository, error) {
repoIDs = append(repoIDs, access.RepoID)
}
repos := make([]*Repository, 0, len(repoIDs))
- return repos, x.Where("owner_id != ?", u.Id).In("id", repoIDs).Desc("updated").Find(&repos)
+ return repos, x.Where("owner_id != ?", u.Id).In("id", repoIDs).Desc("updated_unix").Find(&repos)
}
func maxAccessMode(modes ...AccessMode) AccessMode {
diff --git a/models/issue.go b/models/issue.go
index 9dcff15a3f..067f0a0ba0 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -495,11 +495,11 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) {
switch opts.SortType {
case "oldest":
- sess.Asc("created")
+ sess.Asc("created_unix")
case "recentupdate":
- sess.Desc("updated")
+ sess.Desc("updated_unix")
case "leastupdate":
- sess.Asc("updated")
+ sess.Asc("updated_unix")
case "mostcomment":
sess.Desc("num_comments")
case "leastcomment":
@@ -507,7 +507,7 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) {
case "priority":
sess.Desc("priority")
default:
- sess.Desc("created")
+ sess.Desc("created_unix")
}
labelIDs := base.StringsToInt64s(strings.Split(opts.Labels, ","))
diff --git a/models/issue_comment.go b/models/issue_comment.go
index f0cc6188a0..7c96a7d34e 100644
--- a/models/issue_comment.go
+++ b/models/issue_comment.go
@@ -310,7 +310,7 @@ func GetCommentByID(id int64) (*Comment, error) {
// GetCommentsByIssueID returns all comments of issue by given ID.
func GetCommentsByIssueID(issueID int64) ([]*Comment, error) {
comments := make([]*Comment, 0, 10)
- return comments, x.Where("issue_id=?", issueID).Asc("created").Find(&comments)
+ return comments, x.Where("issue_id=?", issueID).Asc("created_unix").Find(&comments)
}
// UpdateComment updates information of comment.
diff --git a/models/release.go b/models/release.go
index b52b63941a..2379bdc628 100644
--- a/models/release.go
+++ b/models/release.go
@@ -131,7 +131,7 @@ func GetReleaseByID(id int64) (*Release, error) {
// GetReleasesByRepoID returns a list of releases of repository.
func GetReleasesByRepoID(repoID int64) (rels []*Release, err error) {
- err = x.Desc("created").Find(&rels, Release{RepoID: repoID})
+ err = x.Desc("created_unix").Find(&rels, Release{RepoID: repoID})
return rels, err
}
diff --git a/models/repo.go b/models/repo.go
index b5567bf683..4ee99dab7c 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -1464,7 +1464,8 @@ func GetRepositoryByID(id int64) (*Repository, error) {
// GetRepositories returns a list of repositories of given user.
func GetRepositories(uid int64, private bool) ([]*Repository, error) {
repos := make([]*Repository, 0, 10)
- sess := x.Desc("updated")
+ sess := x.Desc("updated_unix")
+
if !private {
sess.Where("is_private=?", false)
}
@@ -1475,7 +1476,7 @@ func GetRepositories(uid int64, private bool) ([]*Repository, error) {
// GetRecentUpdatedRepositories returns the list of repositories that are recently updated.
func GetRecentUpdatedRepositories(page int) (repos []*Repository, err error) {
return repos, x.Limit(setting.ExplorePagingNum, (page-1)*setting.ExplorePagingNum).
- Where("is_private=?", false).Limit(setting.ExplorePagingNum).Desc("updated").Find(&repos)
+ Where("is_private=?", false).Limit(setting.ExplorePagingNum).Desc("updated_unix").Find(&repos)
}
func getRepositoryCount(e Engine, u *User) (int64, error) {