mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-05 15:18:43 +00:00
Fixing nil value in newly added column
This commit is contained in:
parent
f0c641fa9d
commit
fb6c2f1c20
13 changed files with 61 additions and 6 deletions
|
@ -188,6 +188,10 @@ var migrations = []struct {
|
||||||
name: "update-table-set-repo-fallback",
|
name: "update-table-set-repo-fallback",
|
||||||
stmt: updateTableSetRepoFallback,
|
stmt: updateTableSetRepoFallback,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "update-table-set-repo-fallback-again",
|
||||||
|
stmt: updateTableSetRepoFallbackAgain,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Migrate performs the database migration. If the migration fails
|
// Migrate performs the database migration. If the migration fails
|
||||||
|
@ -713,3 +717,11 @@ ALTER TABLE repos ADD COLUMN repo_fallback BOOLEAN
|
||||||
var updateTableSetRepoFallback = `
|
var updateTableSetRepoFallback = `
|
||||||
UPDATE repos SET repo_fallback='false'
|
UPDATE repos SET repo_fallback='false'
|
||||||
`
|
`
|
||||||
|
|
||||||
|
//
|
||||||
|
// 024_add_repo_fallback_column.sql
|
||||||
|
//
|
||||||
|
|
||||||
|
var updateTableSetRepoFallbackAgain = `
|
||||||
|
UPDATE repos SET repo_fallback='false'
|
||||||
|
`
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
-- name: update-table-set-repo-fallback-again
|
||||||
|
UPDATE repos SET repo_fallback='false'
|
|
@ -188,6 +188,10 @@ var migrations = []struct {
|
||||||
name: "update-table-set-repo-fallback",
|
name: "update-table-set-repo-fallback",
|
||||||
stmt: updateTableSetRepoFallback,
|
stmt: updateTableSetRepoFallback,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "update-table-set-repo-fallback-again",
|
||||||
|
stmt: updateTableSetRepoFallbackAgain,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Migrate performs the database migration. If the migration fails
|
// Migrate performs the database migration. If the migration fails
|
||||||
|
@ -715,3 +719,11 @@ ALTER TABLE repos ADD COLUMN repo_fallback BOOLEAN
|
||||||
var updateTableSetRepoFallback = `
|
var updateTableSetRepoFallback = `
|
||||||
UPDATE repos SET repo_fallback='false'
|
UPDATE repos SET repo_fallback='false'
|
||||||
`
|
`
|
||||||
|
|
||||||
|
//
|
||||||
|
// 024_add_repo_fallback_column.sql
|
||||||
|
//
|
||||||
|
|
||||||
|
var updateTableSetRepoFallbackAgain = `
|
||||||
|
UPDATE repos SET repo_fallback='false'
|
||||||
|
`
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
-- name: update-table-set-repo-fallback-again
|
||||||
|
UPDATE repos SET repo_fallback='false'
|
|
@ -192,6 +192,10 @@ var migrations = []struct {
|
||||||
name: "update-table-set-repo-fallback",
|
name: "update-table-set-repo-fallback",
|
||||||
stmt: updateTableSetRepoFallback,
|
stmt: updateTableSetRepoFallback,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "update-table-set-repo-fallback-again",
|
||||||
|
stmt: updateTableSetRepoFallbackAgain,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Migrate performs the database migration. If the migration fails
|
// Migrate performs the database migration. If the migration fails
|
||||||
|
@ -714,3 +718,11 @@ ALTER TABLE repos ADD COLUMN repo_fallback BOOLEAN
|
||||||
var updateTableSetRepoFallback = `
|
var updateTableSetRepoFallback = `
|
||||||
UPDATE repos SET repo_fallback='false'
|
UPDATE repos SET repo_fallback='false'
|
||||||
`
|
`
|
||||||
|
|
||||||
|
//
|
||||||
|
// 024_add_repo_fallback_column.sql
|
||||||
|
//
|
||||||
|
|
||||||
|
var updateTableSetRepoFallbackAgain = `
|
||||||
|
UPDATE repos SET repo_fallback='false'
|
||||||
|
`
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
-- name: update-table-set-repo-fallback-again
|
||||||
|
UPDATE repos SET repo_fallback='false'
|
|
@ -93,6 +93,7 @@ func (db *datastore) RepoBatch(repos []*model.Repo) error {
|
||||||
repo.IsGated,
|
repo.IsGated,
|
||||||
repo.Visibility,
|
repo.Visibility,
|
||||||
repo.Counter,
|
repo.Counter,
|
||||||
|
repo.Fallback,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -30,6 +30,7 @@ SELECT
|
||||||
,repo_gated
|
,repo_gated
|
||||||
,repo_visibility
|
,repo_visibility
|
||||||
,repo_counter
|
,repo_counter
|
||||||
|
,repo_fallback
|
||||||
FROM repos
|
FROM repos
|
||||||
INNER JOIN perms ON perms.perm_repo_id = repos.repo_id
|
INNER JOIN perms ON perms.perm_repo_id = repos.repo_id
|
||||||
WHERE perms.perm_user_id = ?
|
WHERE perms.perm_user_id = ?
|
||||||
|
@ -60,7 +61,8 @@ INSERT IGNORE INTO repos (
|
||||||
,repo_gated
|
,repo_gated
|
||||||
,repo_visibility
|
,repo_visibility
|
||||||
,repo_counter
|
,repo_counter
|
||||||
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
,repo_fallback
|
||||||
|
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
||||||
|
|
||||||
-- name: repo-delete
|
-- name: repo-delete
|
||||||
|
|
||||||
|
|
|
@ -448,6 +448,7 @@ SELECT
|
||||||
,repo_gated
|
,repo_gated
|
||||||
,repo_visibility
|
,repo_visibility
|
||||||
,repo_counter
|
,repo_counter
|
||||||
|
,repo_fallback
|
||||||
FROM repos
|
FROM repos
|
||||||
INNER JOIN perms ON perms.perm_repo_id = repos.repo_id
|
INNER JOIN perms ON perms.perm_repo_id = repos.repo_id
|
||||||
WHERE perms.perm_user_id = ?
|
WHERE perms.perm_user_id = ?
|
||||||
|
@ -478,7 +479,8 @@ INSERT IGNORE INTO repos (
|
||||||
,repo_gated
|
,repo_gated
|
||||||
,repo_visibility
|
,repo_visibility
|
||||||
,repo_counter
|
,repo_counter
|
||||||
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
,repo_fallback
|
||||||
|
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
||||||
`
|
`
|
||||||
|
|
||||||
var repoDelete = `
|
var repoDelete = `
|
||||||
|
|
|
@ -30,6 +30,7 @@ SELECT
|
||||||
,repo_gated
|
,repo_gated
|
||||||
,repo_visibility
|
,repo_visibility
|
||||||
,repo_counter
|
,repo_counter
|
||||||
|
,repo_fallback
|
||||||
FROM repos
|
FROM repos
|
||||||
INNER JOIN perms ON perms.perm_repo_id = repos.repo_id
|
INNER JOIN perms ON perms.perm_repo_id = repos.repo_id
|
||||||
WHERE perms.perm_user_id = $1
|
WHERE perms.perm_user_id = $1
|
||||||
|
@ -60,7 +61,8 @@ INSERT INTO repos (
|
||||||
,repo_gated
|
,repo_gated
|
||||||
,repo_visibility
|
,repo_visibility
|
||||||
,repo_counter
|
,repo_counter
|
||||||
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22)
|
,repo_fallback
|
||||||
|
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23)
|
||||||
ON CONFLICT (repo_full_name) DO NOTHING
|
ON CONFLICT (repo_full_name) DO NOTHING
|
||||||
|
|
||||||
-- name: repo-delete
|
-- name: repo-delete
|
||||||
|
|
|
@ -451,6 +451,7 @@ SELECT
|
||||||
,repo_gated
|
,repo_gated
|
||||||
,repo_visibility
|
,repo_visibility
|
||||||
,repo_counter
|
,repo_counter
|
||||||
|
,repo_fallback
|
||||||
FROM repos
|
FROM repos
|
||||||
INNER JOIN perms ON perms.perm_repo_id = repos.repo_id
|
INNER JOIN perms ON perms.perm_repo_id = repos.repo_id
|
||||||
WHERE perms.perm_user_id = $1
|
WHERE perms.perm_user_id = $1
|
||||||
|
@ -481,7 +482,8 @@ INSERT INTO repos (
|
||||||
,repo_gated
|
,repo_gated
|
||||||
,repo_visibility
|
,repo_visibility
|
||||||
,repo_counter
|
,repo_counter
|
||||||
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22)
|
,repo_fallback
|
||||||
|
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23)
|
||||||
ON CONFLICT (repo_full_name) DO NOTHING
|
ON CONFLICT (repo_full_name) DO NOTHING
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ SELECT
|
||||||
,repo_gated
|
,repo_gated
|
||||||
,repo_visibility
|
,repo_visibility
|
||||||
,repo_counter
|
,repo_counter
|
||||||
|
,repo_fallback
|
||||||
FROM repos
|
FROM repos
|
||||||
INNER JOIN perms ON perms.perm_repo_id = repos.repo_id
|
INNER JOIN perms ON perms.perm_repo_id = repos.repo_id
|
||||||
WHERE perms.perm_user_id = ?
|
WHERE perms.perm_user_id = ?
|
||||||
|
@ -60,7 +61,8 @@ INSERT OR IGNORE INTO repos (
|
||||||
,repo_gated
|
,repo_gated
|
||||||
,repo_visibility
|
,repo_visibility
|
||||||
,repo_counter
|
,repo_counter
|
||||||
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
,repo_fallback
|
||||||
|
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
||||||
|
|
||||||
-- name: repo-delete
|
-- name: repo-delete
|
||||||
|
|
||||||
|
|
|
@ -448,6 +448,7 @@ SELECT
|
||||||
,repo_gated
|
,repo_gated
|
||||||
,repo_visibility
|
,repo_visibility
|
||||||
,repo_counter
|
,repo_counter
|
||||||
|
,repo_fallback
|
||||||
FROM repos
|
FROM repos
|
||||||
INNER JOIN perms ON perms.perm_repo_id = repos.repo_id
|
INNER JOIN perms ON perms.perm_repo_id = repos.repo_id
|
||||||
WHERE perms.perm_user_id = ?
|
WHERE perms.perm_user_id = ?
|
||||||
|
@ -478,7 +479,8 @@ INSERT OR IGNORE INTO repos (
|
||||||
,repo_gated
|
,repo_gated
|
||||||
,repo_visibility
|
,repo_visibility
|
||||||
,repo_counter
|
,repo_counter
|
||||||
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
,repo_fallback
|
||||||
|
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
||||||
`
|
`
|
||||||
|
|
||||||
var repoDelete = `
|
var repoDelete = `
|
||||||
|
|
Loading…
Reference in a new issue