chore: fix problems caused by rebase

This commit is contained in:
Jason Song
2022-11-25 16:35:46 +08:00
parent 295a7f68c8
commit 378e1f8d01
8 changed files with 26 additions and 147 deletions

View File

@@ -46,7 +46,7 @@ func (runners RunnerList) LoadOwners(ctx context.Context) error {
}
func (runners RunnerList) getRepoIDs() []int64 {
repoIDs := make(map[int64]struct{}, len(runners))
repoIDs := make(container.Set[int64], len(runners))
for _, runner := range runners {
if runner.RepoID == 0 {
continue
@@ -55,7 +55,7 @@ func (runners RunnerList) getRepoIDs() []int64 {
repoIDs[runner.RepoID] = struct{}{}
}
}
return container.KeysInt64(repoIDs)
return repoIDs.Values()
}
func (runners RunnerList) LoadRepos(ctx context.Context) error {

View File

@@ -1,61 +0,0 @@
// Copyright 2022 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package migrations
import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/timeutil"
"xorm.io/xorm"
)
func addBotTables(x *xorm.Engine) error {
type BotsRunner struct {
ID int64
UUID string `xorm:"CHAR(36) UNIQUE"`
Name string `xorm:"VARCHAR(32) UNIQUE"`
OS string `xorm:"VARCHAR(16) index"` // the runner running os
Arch string `xorm:"VARCHAR(16) index"` // the runner running architecture
Type string `xorm:"VARCHAR(16)"`
OwnerID int64 `xorm:"index"` // org level runner, 0 means system
RepoID int64 `xorm:"index"` // repo level runner, if orgid also is zero, then it's a global
Description string `xorm:"TEXT"`
Base int // 0 native 1 docker 2 virtual machine
RepoRange string // glob match which repositories could use this runner
Token string
LastOnline timeutil.TimeStamp `xorm:"index"`
Created timeutil.TimeStamp `xorm:"created"`
}
type BotsBuild struct {
ID int64
Title string
UUID string `xorm:"CHAR(36)"`
Index int64 `xorm:"index unique(repo_index)"`
RepoID int64 `xorm:"index unique(repo_index)"`
TriggerUserID int64
Ref string
CommitSHA string
Event string
Token string // token for this task
Grant string // permissions for this task
EventPayload string `xorm:"LONGTEXT"`
RunnerID int64 `xorm:"index"`
Status int `xorm:"index"`
Created timeutil.TimeStamp `xorm:"created"`
StartTime timeutil.TimeStamp
EndTime timeutil.TimeStamp
Updated timeutil.TimeStamp `xorm:"updated"`
}
type Repository struct {
NumBuilds int `xorm:"NOT NULL DEFAULT 0"`
NumClosedBuilds int `xorm:"NOT NULL DEFAULT 0"`
}
type BotsBuildIndex db.ResourceIndex
return x.Sync2(new(BotsRunner), new(BotsBuild), new(Repository), new(BotsBuildIndex))
}

View File

@@ -1,25 +0,0 @@
// Copyright 2022 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package migrations
import (
"code.gitea.io/gitea/modules/timeutil"
"xorm.io/xorm"
)
func createSecretsTable(x *xorm.Engine) error {
type Secret struct {
ID int64
UserID int64 `xorm:"index"`
RepoID int64 `xorm:"index"`
Name string
Data string
PullRequest bool
CreatedUnix timeutil.TimeStamp `xorm:"created"`
}
return x.Sync(new(Secret))
}

View File

@@ -1,25 +0,0 @@
// Copyright 2022 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package migrations
import (
"code.gitea.io/gitea/modules/timeutil"
"xorm.io/xorm"
)
func createSecretsTable(x *xorm.Engine) error {
type Secret struct {
ID int64
UserID int64 `xorm:"index NOTNULL"`
RepoID int64 `xorm:"index NOTNULL"`
Name string `xorm:"NOTNULL"`
Data string `xorm:"TEXT"`
PullRequest bool `xorm:"NOTNULL"`
CreatedUnix timeutil.TimeStamp `xorm:"created NOTNULL"`
}
return x.Sync(new(Secret))
}