Skip to content

Commit

Permalink
fix(migration): make redis schema migrations reentrant (#12992)
Browse files Browse the repository at this point in the history
(cherry picked from commit 328097a)
  • Loading branch information
nowNick authored and github-actions[bot] committed May 8, 2024
1 parent 0349b1a commit 766c363
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
8 changes: 4 additions & 4 deletions kong/plugins/acme/migrations/003_350_to_360.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ return {
'{storage_config,redis}',
config #> '{storage_config, redis}'
|| jsonb_build_object(
'password', config #> '{storage_config, redis, auth}',
'server_name', config #> '{storage_config, redis, ssl_server_name}',
'password', COALESCE(config #> '{storage_config, redis, auth}', config #> '{storage_config, redis, password}'),
'server_name', COALESCE(config #> '{storage_config, redis, ssl_server_name}', config #> '{storage_config, redis, server_name}'),
'extra_options', jsonb_build_object(
'scan_count', config #> '{storage_config, redis, scan_count}',
'namespace', config #> '{storage_config, redis, namespace}'
'scan_count', COALESCE(config #> '{storage_config, redis, scan_count}', config #> '{storage_config, redis, extra_options, scan_count}'),
'namespace', COALESCE(config #> '{storage_config, redis, namespace}', config #> '{storage_config, redis, extra_options, namespace}')
)
)
)
Expand Down
18 changes: 9 additions & 9 deletions kong/plugins/rate-limiting/migrations/006_350_to_360.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ return {
|| jsonb_build_object(
'redis',
jsonb_build_object(
'host', config->'redis_host',
'port', config->'redis_port',
'password', config->'redis_password',
'username', config->'redis_username',
'ssl', config->'redis_ssl',
'ssl_verify', config->'redis_ssl_verify',
'server_name', config->'redis_server_name',
'timeout', config->'redis_timeout',
'database', config->'redis_database'
'host', COALESCE(config->'redis_host', config #> '{redis, host}'),
'port', COALESCE(config->'redis_port', config #> '{redis, port}'),
'password', COALESCE(config->'redis_password', config #> '{redis, password}'),
'username', COALESCE(config->'redis_username', config #> '{redis, username}'),
'ssl', COALESCE(config->'redis_ssl', config #> '{redis, ssl}'),
'ssl_verify', COALESCE(config->'redis_ssl_verify', config #> '{redis, ssl_verify}'),
'server_name', COALESCE(config->'redis_server_name', config #> '{redis, server_name}'),
'timeout', COALESCE(config->'redis_timeout', config #> '{redis, timeout}'),
'database', COALESCE(config->'redis_database', config #> '{redis, database}')
)
)
WHERE name = 'rate-limiting';
Expand Down
18 changes: 9 additions & 9 deletions kong/plugins/response-ratelimiting/migrations/001_350_to_360.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ return {
|| jsonb_build_object(
'redis',
jsonb_build_object(
'host', config->'redis_host',
'port', config->'redis_port',
'password', config->'redis_password',
'username', config->'redis_username',
'ssl', config->'redis_ssl',
'ssl_verify', config->'redis_ssl_verify',
'server_name', config->'redis_server_name',
'timeout', config->'redis_timeout',
'database', config->'redis_database'
'host', COALESCE(config->'redis_host', config #> '{redis, host}'),
'port', COALESCE(config->'redis_port', config #> '{redis, port}'),
'password', COALESCE(config->'redis_password', config #> '{redis, password}'),
'username', COALESCE(config->'redis_username', config #> '{redis, username}'),
'ssl', COALESCE(config->'redis_ssl', config #> '{redis, ssl}'),
'ssl_verify', COALESCE(config->'redis_ssl_verify', config #> '{redis, ssl_verify}'),
'server_name', COALESCE(config->'redis_server_name', config #> '{redis, server_name}'),
'timeout', COALESCE(config->'redis_timeout', config #> '{redis, timeout}'),
'database', COALESCE(config->'redis_database', config #> '{redis, database}')
)
)
WHERE name = 'response-ratelimiting';
Expand Down

0 comments on commit 766c363

Please sign in to comment.