diff options
Diffstat (limited to 'models/models.go')
-rw-r--r-- | models/models.go | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/models/models.go b/models/models.go index 070784f1..4e2e08cf 100644 --- a/models/models.go +++ b/models/models.go @@ -32,11 +32,12 @@ var ( ) func init() { - tables = append(tables, new(User), new(PublicKey), new(Repository), new(Watch), - new(Action), new(Access), new(Issue), new(Comment), new(Oauth2), new(Follow), + tables = append(tables, new(User), new(PublicKey), + new(Repository), new(Watch), new(Star), new(Action), new(Access), + new(Issue), new(Comment), new(Oauth2), new(Follow), new(Mirror), new(Release), new(LoginSource), new(Webhook), new(IssueUser), new(Milestone), new(Label), new(HookTask), new(Team), new(OrgUser), new(TeamUser), - new(UpdateTask)) + new(UpdateTask), new(Attachment)) } func LoadModelsConfig() { @@ -126,6 +127,7 @@ func SetEngine() (err error) { x.ShowSQL = true x.ShowDebug = true x.ShowErr = true + x.ShowWarn = true return nil } @@ -141,30 +143,45 @@ func NewEngine() (err error) { type Statistic struct { Counter struct { - User, PublicKey, Repo, Watch, Action, Access, - Issue, Comment, Mirror, Oauth, Release, - LoginSource, Webhook, Milestone int64 + User, Org, PublicKey, + Repo, Watch, Star, Action, Access, + Issue, Comment, Oauth, Follow, + Mirror, Release, LoginSource, Webhook, + Milestone, Label, HookTask, + Team, UpdateTask, Attachment int64 } } func GetStatistic() (stats Statistic) { - stats.Counter.User, _ = x.Count(new(User)) + stats.Counter.User = CountUsers() + stats.Counter.Org = CountOrganizations() stats.Counter.PublicKey, _ = x.Count(new(PublicKey)) - stats.Counter.Repo, _ = x.Count(new(Repository)) + stats.Counter.Repo = CountRepositories() stats.Counter.Watch, _ = x.Count(new(Watch)) + stats.Counter.Star, _ = x.Count(new(Star)) stats.Counter.Action, _ = x.Count(new(Action)) stats.Counter.Access, _ = x.Count(new(Access)) stats.Counter.Issue, _ = x.Count(new(Issue)) stats.Counter.Comment, _ = x.Count(new(Comment)) - stats.Counter.Mirror, _ = x.Count(new(Mirror)) stats.Counter.Oauth, _ = x.Count(new(Oauth2)) + stats.Counter.Follow, _ = x.Count(new(Follow)) + stats.Counter.Mirror, _ = x.Count(new(Mirror)) stats.Counter.Release, _ = x.Count(new(Release)) stats.Counter.LoginSource, _ = x.Count(new(LoginSource)) stats.Counter.Webhook, _ = x.Count(new(Webhook)) stats.Counter.Milestone, _ = x.Count(new(Milestone)) + stats.Counter.Label, _ = x.Count(new(Label)) + stats.Counter.HookTask, _ = x.Count(new(HookTask)) + stats.Counter.Team, _ = x.Count(new(Team)) + stats.Counter.UpdateTask, _ = x.Count(new(UpdateTask)) + stats.Counter.Attachment, _ = x.Count(new(Attachment)) return } +func Ping() error { + return x.Ping() +} + // DumpDatabase dumps all data from database to file system. func DumpDatabase(filePath string) error { return x.DumpAllToFile(filePath) |