fix(ns-api): guard ports-check migration against non-JSON last_probe_result

The 20260415 migration cast last_probe_result::jsonb guarded only by a
btrim non-empty check, so any row with non-JSON text aborted the whole
migration. Add the same last_probe_result ~ '^[\[{]' guard the follow-up
20260519133000 migration uses, directly to both UPDATEs here.
This commit is contained in:
Jędrzej Stuczyński
2026-06-01 16:18:24 +01:00
parent 639c7f83a4
commit 2fd26581eb
@@ -4,6 +4,7 @@ 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;
@@ -11,4 +12,5 @@ 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';