Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(db) blue/green migration for route regex path #9334

Merged
merged 1 commit into from
Sep 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions kong/db/migrations/core/016_280_to_300.lua
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ local function c_copy_vaults_beta_to_sm_vaults(coordinator)
end


local function c_normalize_regex_path(coordinator)
local function c_migrate_regex_path(coordinator)
for rows, err in coordinator:iterate("SELECT id, paths FROM routes") do
if err then
return nil, err
Expand Down Expand Up @@ -320,6 +320,8 @@ return {
$$;
]],

up_f = p_migrate_regex_path,

teardown = function(connector)
local _, err = connector:query([[
DROP TABLE IF EXISTS vaults_beta;
Expand All @@ -335,11 +337,6 @@ return {
return nil, err
end

_, err = p_migrate_regex_path(connector)
if err then
return nil, err
end

return true
end
},
Expand Down Expand Up @@ -406,6 +403,11 @@ return {
if err then
return nil, err
end

_, err = c_migrate_regex_path(coordinator)
if err then
return nil, err
end
end,

teardown = function(connector)
Expand Down Expand Up @@ -437,11 +439,6 @@ return {
return nil, err
end

_, err = c_normalize_regex_path(coordinator)
if err then
return nil, err
end

return true
end
},
Expand Down