mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-23 08:56:29 +00:00
Migrating build configs to the new schema
This commit is contained in:
parent
7420131019
commit
806249ec16
6 changed files with 51 additions and 0 deletions
|
@ -168,6 +168,10 @@ var migrations = []struct {
|
|||
name: "update-table-set-config-name",
|
||||
stmt: updateTableSetConfigName,
|
||||
},
|
||||
{
|
||||
name: "populate-build-config",
|
||||
stmt: populateBuildConfig,
|
||||
},
|
||||
}
|
||||
|
||||
// Migrate performs the database migration. If the migration fails
|
||||
|
@ -660,3 +664,12 @@ ALTER TABLE config ADD COLUMN config_name TEXT
|
|||
var updateTableSetConfigName = `
|
||||
UPDATE config SET config_name = "drone"
|
||||
`
|
||||
|
||||
//
|
||||
// 021_populate_build_config.sql
|
||||
//
|
||||
|
||||
var populateBuildConfig = `
|
||||
INSERT INTO build_config (config_id, build_id)
|
||||
SELECT build_config_id, build_id FROM builds
|
||||
`
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
-- name: populate-build-config
|
||||
|
||||
INSERT INTO build_config (config_id, build_id)
|
||||
SELECT build_config_id, build_id FROM builds
|
|
@ -168,6 +168,10 @@ var migrations = []struct {
|
|||
name: "update-table-set-config-name",
|
||||
stmt: updateTableSetConfigName,
|
||||
},
|
||||
{
|
||||
name: "populate-build-config",
|
||||
stmt: populateBuildConfig,
|
||||
},
|
||||
}
|
||||
|
||||
// Migrate performs the database migration. If the migration fails
|
||||
|
@ -662,3 +666,12 @@ ALTER TABLE config ADD COLUMN config_name TEXT
|
|||
var updateTableSetConfigName = `
|
||||
UPDATE config SET config_name = 'drone'
|
||||
`
|
||||
|
||||
//
|
||||
// 021_populate_build_config.sql
|
||||
//
|
||||
|
||||
var populateBuildConfig = `
|
||||
INSERT INTO build_config (config_id, build_id)
|
||||
SELECT build_config_id, build_id FROM builds
|
||||
`
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
-- name: populate-build-config
|
||||
|
||||
INSERT INTO build_config (config_id, build_id)
|
||||
SELECT build_config_id, build_id FROM builds
|
|
@ -172,6 +172,10 @@ var migrations = []struct {
|
|||
name: "update-table-set-config-name",
|
||||
stmt: updateTableSetConfigName,
|
||||
},
|
||||
{
|
||||
name: "populate-build-config",
|
||||
stmt: populateBuildConfig,
|
||||
},
|
||||
}
|
||||
|
||||
// Migrate performs the database migration. If the migration fails
|
||||
|
@ -661,3 +665,12 @@ ALTER TABLE config ADD COLUMN config_name TEXT
|
|||
var updateTableSetConfigName = `
|
||||
UPDATE config SET config_name = "drone"
|
||||
`
|
||||
|
||||
//
|
||||
// 021_populate_build_config.sql
|
||||
//
|
||||
|
||||
var populateBuildConfig = `
|
||||
INSERT INTO build_config (config_id, build_id)
|
||||
SELECT build_config_id, build_id FROM builds
|
||||
`
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
-- name: populate-build-config
|
||||
|
||||
INSERT INTO build_config (config_id, build_id)
|
||||
SELECT build_config_id, build_id FROM builds
|
Loading…
Reference in a new issue