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

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

diff --git a/db/migrate/20200810053843_create_data_explorer_queries.rb b/db/migrate/20200810053843_create_data_explorer_queries.rb
index 29909df..2410c2e 100644
--- a/db/migrate/20200810053843_create_data_explorer_queries.rb
+++ b/db/migrate/20200810053843_create_data_explorer_queries.rb
@@ -37,8 +37,10 @@ class CreateDataExplorerQueries < ActiveRecord::Migration[6.0]
         END,
         CASE WHEN (value::json->'hidden')::text = 'null' THEN
           false
-        ELSE
+        WHEN (value::jsonb ? 'hidden') THEN
           (value::json->'hidden')::text::boolean
+        ELSE
+          false
         END,
         :now,
         :now
@@ -60,10 +62,12 @@ class CreateDataExplorerQueries < ActiveRecord::Migration[6.0]
         ELSE
           (value::json->'last_run_at')::text::timestamptz
         END,
-        CASE WHEN (value::json->'hidden')::text = 'null' THEN 
+        CASE WHEN (value::json->'hidden')::text = 'null' THEN
           false
-        ELSE
+        WHEN (value::jsonb ? 'hidden') THEN
           (value::json->'hidden')::text::boolean
+        ELSE
+          false
         END,
         :now,
         :now

GitHub sha: 7696d459