diff --git a/nym-node-status-api/nym-node-status-api/migrations_pg/20260415000000_gateways_ports_check.sql b/nym-node-status-api/nym-node-status-api/migrations_pg/20260415000000_gateways_ports_check.sql index f506b093f5..e521cb2aa5 100644 --- a/nym-node-status-api/nym-node-status-api/migrations_pg/20260415000000_gateways_ports_check.sql +++ b/nym-node-status-api/nym-node-status-api/migrations_pg/20260415000000_gateways_ports_check.sql @@ -4,7 +4,6 @@ UPDATE gateways SET ports_check = (last_probe_result::jsonb -> 'ports_check') WHERE last_probe_result IS NOT NULL AND btrim(last_probe_result) <> '' - AND last_probe_result ~ '^[\[{]' AND last_probe_result::jsonb ? 'ports_check' AND ports_check IS NULL; @@ -12,5 +11,4 @@ UPDATE gateways SET last_probe_result = (last_probe_result::jsonb - 'ports_check')::text WHERE last_probe_result IS NOT NULL AND btrim(last_probe_result) <> '' - AND last_probe_result ~ '^[\[{]' AND last_probe_result::jsonb ? 'ports_check'; \ No newline at end of file diff --git a/nym-node-status-api/nym-node-status-api/migrations_pg/20260519133000_gateways_ports_check_json_guard.sql b/nym-node-status-api/nym-node-status-api/migrations_pg/20260519133000_gateways_ports_check_json_guard.sql new file mode 100644 index 0000000000..bcdb3b4b7d --- /dev/null +++ b/nym-node-status-api/nym-node-status-api/migrations_pg/20260519133000_gateways_ports_check_json_guard.sql @@ -0,0 +1,14 @@ +UPDATE gateways +SET ports_check = (last_probe_result::jsonb -> 'ports_check') +WHERE last_probe_result IS NOT NULL + AND btrim(last_probe_result) <> '' + AND last_probe_result ~ '^[\[{]' + AND last_probe_result::jsonb ? 'ports_check' + AND ports_check IS NULL; + +UPDATE gateways +SET last_probe_result = (last_probe_result::jsonb - 'ports_check')::text +WHERE last_probe_result IS NOT NULL + AND btrim(last_probe_result) <> '' + AND last_probe_result ~ '^[\[{]' + AND last_probe_result::jsonb ? 'ports_check';