add coalesce around boards description (#3289)

This commit is contained in:
Scott Bishel 2022-06-29 16:17:11 -06:00 committed by GitHub
parent f227a9ea3a
commit 429a4e484d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,