You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-07-12 22:21:40 +02:00
add migration function to remove null repo counters
This commit is contained in:
@ -104,6 +104,10 @@ var migrations = []struct {
|
|||||||
name: "update-table-set-repo-seq",
|
name: "update-table-set-repo-seq",
|
||||||
stmt: updateTableSetRepoSeq,
|
stmt: updateTableSetRepoSeq,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "update-table-set-repo-seq-default",
|
||||||
|
stmt: updateTableSetRepoSeqDefault,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Migrate performs the database migration. If the migration fails
|
// 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
|
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
|
FROM builds
|
||||||
WHERE builds.build_repo_id = repos.repo_id
|
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",
|
name: "update-table-set-repo-seq",
|
||||||
stmt: updateTableSetRepoSeq,
|
stmt: updateTableSetRepoSeq,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "update-table-set-repo-seq-default",
|
||||||
|
stmt: updateTableSetRepoSeqDefault,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Migrate performs the database migration. If the migration fails
|
// 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
|
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
|
FROM builds
|
||||||
WHERE builds.build_repo_id = repos.repo_id
|
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",
|
name: "update-table-set-repo-seq",
|
||||||
stmt: updateTableSetRepoSeq,
|
stmt: updateTableSetRepoSeq,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "update-table-set-repo-seq-default",
|
||||||
|
stmt: updateTableSetRepoSeqDefault,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Migrate performs the database migration. If the migration fails
|
// 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
|
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
|
FROM builds
|
||||||
WHERE builds.build_repo_id = repos.repo_id
|
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
|
||||||
|
Reference in New Issue
Block a user