From f4ff0a41b5688c6a7fde4e9a87ee2ea55b6c7c5a Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Tue, 12 Oct 2021 10:20:32 +0800 Subject: [PATCH] add repo statistic --- models/models.go | 2 +- models/repo_statistic.go | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100755 models/repo_statistic.go diff --git a/models/models.go b/models/models.go index 3927dfbf0..412148235 100755 --- a/models/models.go +++ b/models/models.go @@ -136,7 +136,7 @@ func init() { ) tablesStatistic = append(tablesStatistic, - new(FileChunk), + new(RepoStatistic), new(UserBusinessAnalysis), ) diff --git a/models/repo_statistic.go b/models/repo_statistic.go new file mode 100755 index 000000000..a95340225 --- /dev/null +++ b/models/repo_statistic.go @@ -0,0 +1,37 @@ +package models + +import ( + "time" + + "code.gitea.io/gitea/modules/timeutil" +) + +// RepoStatistic statistic info of all repository +type RepoStatistic struct { + ID int64 `xorm:"pk autoincr"` + RepoID int64 `xorm:"unique(s) NOT NULL"` + Date time.Time `xorm:"unique(s) NOT NULL"` + NumWatches int64 `xorm:"NOT NULL DEFAULT 0"` + NumStars int64 `xorm:"NOT NULL DEFAULT 0"` + NumForks int64 `xorm:"NOT NULL DEFAULT 0"` + NumDownloads int64 `xorm:"NOT NULL DEFAULT 0"` + NumComments int64 `xorm:"NOT NULL DEFAULT 0"` + NumViews int64 `xorm:"NOT NULL DEFAULT 0"` + NumClosedIssues int64 `xorm:"NOT NULL DEFAULT 0"` + NumVersions int64 `xorm:"NOT NULL DEFAULT 0"` + //develop months + NumDevMonths int64 `xorm:"NOT NULL DEFAULT 0"` + RepoSize int64 `xorm:"NOT NULL DEFAULT 0"` + DatasetSize int64 `xorm:"NOT NULL DEFAULT 0"` + NumModels int64 `xorm:"NOT NULL DEFAULT 0"` + NumWikiViews int64 `xorm:"NOT NULL DEFAULT 0"` + NumCommits int64 `xorm:"NOT NULL DEFAULT 0"` + NumIssues int64 `xorm:"NOT NULL DEFAULT 0"` + NumPulls int64 `xorm:"NOT NULL DEFAULT 0"` + IssueFixedRate float32 `xorm:"NOT NULL"` + NumContributor int64 `xorm:"NOT NULL DEFAULT 0"` + NumKeyContributor int64 `xorm:"NOT NULL DEFAULT 0"` + + CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` + UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` +}