1 -- make "external" an JSON object if null
\r
3 JOIN nodes ON nodes.id = node_data.node_id
\r
6 node_data.external IS NULL
\r
7 AND nodes.available_for_rent = 1;
\r
9 -- add "export_portals" array to "external" if it does not exist
\r
11 JOIN nodes ON nodes.id = node_data.node_id
\r
12 SET external = JSON_SET(external, '$.export_portals', JSON_ARRAY())
\r
14 NOT JSON_CONTAINS_PATH(external, 'all', '$.export_portals')
\r
15 AND nodes.available_for_rent = 1;
\r
17 -- add "hpm-api" value to external.export_portals
\r
19 JOIN nodes ON nodes.id = node_data.node_id
\r
20 SET external = JSON_ARRAY_APPEND(external, '$.export_portals', 'hpm-api')
\r
22 NOT JSON_CONTAINS(external, '["hpm-api"]', '$.export_portals')
\r
23 AND nodes.available_for_rent = 1;
\r