Skip to content

Commit c20f43e

Browse files
committed
add SQL execution time on log and index owner_id on repository
1 parent 2183f58 commit c20f43e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

models/models.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ func NewTestEngine(x *xorm.Engine) (err error) {
262262
return fmt.Errorf("Connect to database: %v", err)
263263
}
264264

265+
x.ShowExecTime(true)
265266
x.SetMapper(core.GonicMapper{})
266267
x.SetLogger(NewXORMLogger(!setting.ProdMode))
267268
x.ShowSQL(!setting.ProdMode)
@@ -275,6 +276,7 @@ func SetEngine() (err error) {
275276
return fmt.Errorf("Failed to connect to database: %v", err)
276277
}
277278

279+
x.ShowExecTime(true)
278280
x.SetMapper(core.GonicMapper{})
279281
// WARNING: for serv command, MUST remove the output to os.stdout,
280282
// so use log file to instead print to stdout.

models/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func NewRepoContext() {
129129
// Repository represents a git repository.
130130
type Repository struct {
131131
ID int64 `xorm:"pk autoincr"`
132-
OwnerID int64 `xorm:"UNIQUE(s)"`
132+
OwnerID int64 `xorm:"UNIQUE(s) index"`
133133
OwnerName string `xorm:"-"`
134134
Owner *User `xorm:"-"`
135135
LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"`

0 commit comments

Comments
 (0)