mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-27 02:40:30 +00:00
add migration function to remove null repo counters
This commit is contained in:
parent
62876d6ad9
commit
ee54698c62
6 changed files with 42 additions and 0 deletions
|
@ -104,6 +104,10 @@ var migrations = []struct {
|
|||
name: "update-table-set-repo-seq",
|
||||
stmt: updateTableSetRepoSeq,
|
||||
},
|
||||
{
|
||||
name: "update-table-set-repo-seq-default",
|
||||
stmt: updateTableSetRepoSeqDefault,
|
||||
},
|
||||
}
|
||||
|
||||
// Migrate performs the database migration. If the migration fails
|
||||
|
@ -490,3 +494,8 @@ UPDATE repos SET repo_counter = (
|
|||
WHERE builds.build_repo_id = repos.repo_id
|
||||
)
|
||||
`
|
||||
|
||||
var updateTableSetRepoSeqDefault = `
|
||||
UPDATE repos SET repo_counter = 0
|
||||
WHERE repo_counter IS NULL
|
||||
`
|
||||
|
|
|
@ -9,3 +9,8 @@ UPDATE repos SET repo_counter = (
|
|||
FROM builds
|
||||
WHERE builds.build_repo_id = repos.repo_id
|
||||
)
|
||||
|
||||
-- name: update-table-set-repo-seq-default
|
||||
|
||||
UPDATE repos SET repo_counter = 0
|
||||
WHERE repo_counter IS NULL
|
||||
|
|
|
@ -104,6 +104,10 @@ var migrations = []struct {
|
|||
name: "update-table-set-repo-seq",
|
||||
stmt: updateTableSetRepoSeq,
|
||||
},
|
||||
{
|
||||
name: "update-table-set-repo-seq-default",
|
||||
stmt: updateTableSetRepoSeqDefault,
|
||||
},
|
||||
}
|
||||
|
||||
// Migrate performs the database migration. If the migration fails
|
||||
|
@ -490,3 +494,8 @@ UPDATE repos SET repo_counter = (
|
|||
WHERE builds.build_repo_id = repos.repo_id
|
||||
)
|
||||
`
|
||||
|
||||
var updateTableSetRepoSeqDefault = `
|
||||
UPDATE repos SET repo_counter = 0
|
||||
WHERE repo_counter IS NULL
|
||||
`
|
||||
|
|
|
@ -9,3 +9,8 @@ UPDATE repos SET repo_counter = (
|
|||
FROM builds
|
||||
WHERE builds.build_repo_id = repos.repo_id
|
||||
)
|
||||
|
||||
-- name: update-table-set-repo-seq-default
|
||||
|
||||
UPDATE repos SET repo_counter = 0
|
||||
WHERE repo_counter IS NULL
|
||||
|
|
|
@ -108,6 +108,10 @@ var migrations = []struct {
|
|||
name: "update-table-set-repo-seq",
|
||||
stmt: updateTableSetRepoSeq,
|
||||
},
|
||||
{
|
||||
name: "update-table-set-repo-seq-default",
|
||||
stmt: updateTableSetRepoSeqDefault,
|
||||
},
|
||||
}
|
||||
|
||||
// Migrate performs the database migration. If the migration fails
|
||||
|
@ -491,3 +495,8 @@ UPDATE repos SET repo_counter = (
|
|||
WHERE builds.build_repo_id = repos.repo_id
|
||||
)
|
||||
`
|
||||
|
||||
var updateTableSetRepoSeqDefault = `
|
||||
UPDATE repos SET repo_counter = 0
|
||||
WHERE repo_counter IS NULL
|
||||
`
|
||||
|
|
|
@ -9,3 +9,8 @@ UPDATE repos SET repo_counter = (
|
|||
FROM builds
|
||||
WHERE builds.build_repo_id = repos.repo_id
|
||||
)
|
||||
|
||||
-- name: update-table-set-repo-seq-default
|
||||
|
||||
UPDATE repos SET repo_counter = 0
|
||||
WHERE repo_counter IS NULL
|
||||
|
|
Loading…
Reference in a new issue