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:
+2
@@ -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';
|
||||
Reference in New Issue
Block a user