fix: rename table name string

This commit is contained in:
Jason Song 2022-11-29 13:47:09 +08:00
parent 04d72d3500
commit e33d4d7700
No known key found for this signature in database
GPG Key ID: 8402EEEE4511A8B5
2 changed files with 4 additions and 4 deletions

View File

@ -108,11 +108,11 @@ func (run *BotRun) GetPushEventPayload() (*api.PushPayload, error) {
func updateRepoRunsNumbers(ctx context.Context, repo *repo_model.Repository) error {
_, err := db.GetEngine(ctx).ID(repo.ID).
SetExpr("num_runs",
builder.Select("count(*)").From("bots_run").
builder.Select("count(*)").From("bot_run").
Where(builder.Eq{"repo_id": repo.ID}),
).
SetExpr("num_closed_runs",
builder.Select("count(*)").From("bots_run").
builder.Select("count(*)").From("bot_run").
Where(builder.Eq{
"repo_id": repo.ID,
}.And(
@ -137,7 +137,7 @@ func InsertRun(run *BotRun, jobs []*jobparser.SingleWorkflow) error {
}
defer commiter.Close()
index, err := db.GetNextResourceIndex(ctx, "bots_run_index", run.RepoID)
index, err := db.GetNextResourceIndex(ctx, "bot_run_index", run.RepoID)
if err != nil {
return err
}

View File

@ -196,7 +196,7 @@ func (opts FindRunnerOptions) toOrder() string {
func CountRunners(opts FindRunnerOptions) (int64, error) {
return db.GetEngine(db.DefaultContext).
Table("bots_runner").
Table(BotRunner{}).
Where(opts.toCond()).
OrderBy(opts.toOrder()).
Count()