From 7696d459a4951495f9ae807ce654b7f9c959e7f4 Mon Sep 17 00:00:00 2001 From: Krzysztof Kotlarek Date: Thu, 27 Aug 2020 12:29:27 +1000 Subject: [PATCH] FIX: dont error when json don't contain hidden key --- .../20200810053843_create_data_explorer_queries.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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