1
1
mirror of https://github.com/go-gitea/gitea synced 2025-09-28 03:28:13 +00:00

feat: optimize log indexes

This commit is contained in:
Jason Song
2022-10-18 17:17:58 +08:00
parent bb4963fd4a
commit dd5b2c5dfd
7 changed files with 59 additions and 25 deletions

View File

@@ -142,9 +142,9 @@ type Repository struct {
NumProjects int `xorm:"NOT NULL DEFAULT 0"`
NumClosedProjects int `xorm:"NOT NULL DEFAULT 0"`
NumOpenProjects int `xorm:"-"`
NumBuilds int `xorm:"NOT NULL DEFAULT 0"`
NumClosedBuilds int `xorm:"NOT NULL DEFAULT 0"`
NumOpenBuilds int `xorm:"-"`
NumRuns int `xorm:"NOT NULL DEFAULT 0"`
NumClosedRuns int `xorm:"NOT NULL DEFAULT 0"`
NumOpenRuns int `xorm:"-"`
IsPrivate bool `xorm:"INDEX"`
IsEmpty bool `xorm:"INDEX"`
@@ -237,7 +237,7 @@ func (repo *Repository) AfterLoad() {
repo.NumOpenPulls = repo.NumPulls - repo.NumClosedPulls
repo.NumOpenMilestones = repo.NumMilestones - repo.NumClosedMilestones
repo.NumOpenProjects = repo.NumProjects - repo.NumClosedProjects
repo.NumOpenBuilds = repo.NumBuilds - repo.NumClosedBuilds
repo.NumOpenRuns = repo.NumRuns - repo.NumClosedRuns
}
// LoadAttributes loads attributes of the repository.