FIX: dont error when json don't contain hidden key

This commit is contained in:
Krzysztof Kotlarek 2020-08-27 12:29:27 +10:00
parent 353da45b6f
commit 7696d459a4
1 changed files with 7 additions and 3 deletions

View File

@ -37,8 +37,10 @@ class CreateDataExplorerQueries < ActiveRecord::Migration[6.0]
END, END,
CASE WHEN (value::json->'hidden')::text = 'null' THEN CASE WHEN (value::json->'hidden')::text = 'null' THEN
false false
ELSE WHEN (value::jsonb ? 'hidden') THEN
(value::json->'hidden')::text::boolean (value::json->'hidden')::text::boolean
ELSE
false
END, END,
:now, :now,
:now :now
@ -62,8 +64,10 @@ class CreateDataExplorerQueries < ActiveRecord::Migration[6.0]
END, END,
CASE WHEN (value::json->'hidden')::text = 'null' THEN CASE WHEN (value::json->'hidden')::text = 'null' THEN
false false
ELSE WHEN (value::jsonb ? 'hidden') THEN
(value::json->'hidden')::text::boolean (value::json->'hidden')::text::boolean
ELSE
false
END, END,
:now, :now,
:now :now