FIX: dont error when user id is empty string

This commit is contained in:
Krzysztof Kotlarek 2020-08-27 14:47:43 +10:00
parent 0a694215f8
commit 16873e708a
1 changed files with 10 additions and 2 deletions

View File

@ -27,7 +27,11 @@ class CreateDataExplorerQueries < ActiveRecord::Migration[6.0]
value::json->>'name',
value::json->>'description',
value::json->>'sql',
CASE WHEN (value::jsonb ? 'created_by') THEN
CASE WHEN (value::json->'created_by')::text = 'null' THEN
null
WHEN (value::json->'created_by')::text = '""' THEN
null
WHEN (value::jsonb ? 'created_by') THEN
(value::json->>'created_by')::integer
ELSE
null
@ -58,7 +62,11 @@ class CreateDataExplorerQueries < ActiveRecord::Migration[6.0]
value::json->>'name',
value::json->>'description',
value::json->>'sql',
CASE WHEN (value::jsonb ? 'created_by') THEN
CASE WHEN (value::json->'created_by')::text = 'null' THEN
null
WHEN (value::json->'created_by')::text = '""' THEN
null
WHEN (value::jsonb ? 'created_by') THEN
(value::json->>'created_by')::integer
ELSE
null