From 429a4e484d3b6acbe2d257cd876738850db69da0 Mon Sep 17 00:00:00 2001 From: Scott Bishel Date: Wed, 29 Jun 2022 16:17:11 -0600 Subject: [PATCH] add coalesce around boards description (#3289) --- .../000018_add_teams_and_boards.up.sql | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/server/services/store/sqlstore/migrations/000018_add_teams_and_boards.up.sql b/server/services/store/sqlstore/migrations/000018_add_teams_and_boards.up.sql index 72bb0efe0..ff2139728 100644 --- a/server/services/store/sqlstore/migrations/000018_add_teams_and_boards.up.sql +++ b/server/services/store/sqlstore/migrations/000018_add_teams_and_boards.up.sql @@ -133,7 +133,7 @@ CREATE TABLE IF NOT EXISTS {{.prefix}}boards_history ( INSERT INTO {{.prefix}}boards ( SELECT B.id, B.insert_at, C.TeamId, B.channel_id, B.created_by, B.modified_by, C.type, COALESCE(B.title, ''), - (B.fields->>'description')::text, + COALESCE((B.fields->>'description')::text, ''), B.fields->>'icon', COALESCE((fields->'showDescription')::text::boolean, false), COALESCE((fields->'isTemplate')::text::boolean, false), @@ -147,7 +147,7 @@ CREATE TABLE IF NOT EXISTS {{.prefix}}boards_history ( INSERT INTO {{.prefix}}boards_history ( SELECT B.id, B.insert_at, C.TeamId, B.channel_id, B.created_by, B.modified_by, C.type, COALESCE(B.title, ''), - (B.fields->>'description')::text, + COALESCE((B.fields->>'description')::text, ''), B.fields->>'icon', COALESCE((fields->'showDescription')::text::boolean, false), COALESCE((fields->'isTemplate')::text::boolean, false), @@ -163,7 +163,7 @@ CREATE TABLE IF NOT EXISTS {{.prefix}}boards_history ( INSERT INTO {{.prefix}}boards ( SELECT B.id, B.insert_at, C.TeamId, B.channel_id, B.created_by, B.modified_by, C.Type, COALESCE(B.title, ''), - JSON_UNQUOTE(JSON_EXTRACT(B.fields,'$.description')), + COALESCE(JSON_UNQUOTE(JSON_EXTRACT(B.fields,'$.description')), ''), JSON_UNQUOTE(JSON_EXTRACT(B.fields,'$.icon')), COALESCE(B.fields->'$.showDescription', 'false') = 'true', COALESCE(JSON_EXTRACT(B.fields, '$.isTemplate'), 'false') = 'true', @@ -177,7 +177,7 @@ CREATE TABLE IF NOT EXISTS {{.prefix}}boards_history ( INSERT INTO {{.prefix}}boards_history ( SELECT B.id, B.insert_at, C.TeamId, B.channel_id, B.created_by, B.modified_by, C.Type, COALESCE(B.title, ''), - JSON_UNQUOTE(JSON_EXTRACT(B.fields,'$.description')), + COALESCE(JSON_UNQUOTE(JSON_EXTRACT(B.fields,'$.description')), ''), JSON_UNQUOTE(JSON_EXTRACT(B.fields,'$.icon')), COALESCE(B.fields->'$.showDescription', 'false') = 'true', COALESCE(JSON_EXTRACT(B.fields, '$.isTemplate'), 'false') = 'true', @@ -194,7 +194,7 @@ CREATE TABLE IF NOT EXISTS {{.prefix}}boards_history ( INSERT INTO {{.prefix}}boards ( SELECT id, insert_at, '0', channel_id, created_by, modified_by, 'O', COALESCE(B.title, ''), - (fields->>'description')::text, + COALESCE((fields->>'description')::text, ''), B.fields->>'icon', COALESCE((fields->'showDescription')::text::boolean, false), COALESCE((fields->'isTemplate')::text::boolean, false), @@ -207,7 +207,7 @@ CREATE TABLE IF NOT EXISTS {{.prefix}}boards_history ( INSERT INTO {{.prefix}}boards_history ( SELECT id, insert_at, '0', channel_id, created_by, modified_by, 'O', COALESCE(B.title, ''), - (fields->>'description')::text, + COALESCE((fields->>'description')::text, ''), B.fields->>'icon', COALESCE((fields->'showDescription')::text::boolean, false), COALESCE((fields->'isTemplate')::text::boolean, false), @@ -222,7 +222,7 @@ CREATE TABLE IF NOT EXISTS {{.prefix}}boards_history ( INSERT INTO {{.prefix}}boards ( SELECT id, insert_at, '0', channel_id, created_by, modified_by, 'O', COALESCE(B.title, ''), - JSON_UNQUOTE(JSON_EXTRACT(fields,'$.description')), + COALESCE(JSON_UNQUOTE(JSON_EXTRACT(B.fields,'$.description')), ''), JSON_UNQUOTE(JSON_EXTRACT(fields,'$.icon')), COALESCE(B.fields->'$.showDescription', 'false') = 'true', COALESCE(JSON_EXTRACT(B.fields, '$.isTemplate'), 'false') = 'true', @@ -235,7 +235,7 @@ CREATE TABLE IF NOT EXISTS {{.prefix}}boards_history ( INSERT INTO {{.prefix}}boards_history ( SELECT id, insert_at, '0', channel_id, created_by, modified_by, 'O', COALESCE(B.title, ''), - JSON_UNQUOTE(JSON_EXTRACT(fields,'$.description')), + COALESCE(JSON_UNQUOTE(JSON_EXTRACT(B.fields,'$.description')), ''), JSON_UNQUOTE(JSON_EXTRACT(fields,'$.icon')), COALESCE(B.fields->'$.showDescription', 'false') = 'true', COALESCE(JSON_EXTRACT(B.fields, '$.isTemplate'), 'false') = 'true', @@ -250,7 +250,7 @@ CREATE TABLE IF NOT EXISTS {{.prefix}}boards_history ( INSERT INTO {{.prefix}}boards SELECT id, insert_at, '0', channel_id, created_by, modified_by, 'O', COALESCE(title, ''), - json_extract(fields, '$.description'), + COALESCE(json_extract(fields, '$.description'), ''), json_extract(fields, '$.icon'), json_extract(fields, '$.showDescription'), json_extract(fields, '$.isTemplate'), COALESCE(json_extract(fields, '$.templateVer'), 0), '{}', json_extract(fields, '$.cardProperties'), create_at, @@ -261,7 +261,7 @@ CREATE TABLE IF NOT EXISTS {{.prefix}}boards_history ( INSERT INTO {{.prefix}}boards_history SELECT id, insert_at, '0', channel_id, created_by, modified_by, 'O', COALESCE(title, ''), - json_extract(fields, '$.description'), + COALESCE(json_extract(fields, '$.description'), ''), json_extract(fields, '$.icon'), json_extract(fields, '$.showDescription'), json_extract(fields, '$.isTemplate'), COALESCE(json_extract(fields, '$.templateVer'), 0), '{}', json_extract(fields, '$.cardProperties'), create_at,