aboutsummaryrefslogtreecommitdiffstats
path: root/models/migrations/v91.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-08-05 22:29:40 +0800
committerLauris BH <lauris@nix.lv>2019-08-05 17:29:40 +0300
commit7b009626da2a8a2a46e0e205a3a7ce46cdf7ced2 (patch)
tree3c81393f4592e1b3735740fd4453cf735da00dcd /models/migrations/v91.go
parent52feff5a5c76421fe90c8e6a62ec86eaaa4634f2 (diff)
downloadgitea-7b009626da2a8a2a46e0e205a3a7ce46cdf7ced2.tar.gz
gitea-7b009626da2a8a2a46e0e205a3a7ce46cdf7ced2.zip
Add SQL execution on log and indexes on table repository and comment (#7740)
* add index on comment * add SQL execution time on log and index owner_id on repository * add migration
Diffstat (limited to 'models/migrations/v91.go')
-rw-r--r--models/migrations/v91.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/models/migrations/v91.go b/models/migrations/v91.go
new file mode 100644
index 0000000000..fea71b5d3b
--- /dev/null
+++ b/models/migrations/v91.go
@@ -0,0 +1,26 @@
+// 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 "github.com/go-xorm/xorm"
+
+func addIndexOnRepositoryAndComment(x *xorm.Engine) error {
+ type Repository struct {
+ ID int64 `xorm:"pk autoincr"`
+ OwnerID int64 `xorm:"index"`
+ }
+
+ if err := x.Sync2(new(Repository)); err != nil {
+ return err
+ }
+
+ type Comment struct {
+ ID int64 `xorm:"pk autoincr"`
+ Type int `xorm:"index"`
+ ReviewID int64 `xorm:"index"`
+ }
+
+ return x.Sync2(new(Comment))
+}