Update permissions migration to ensure all boards are either open or private (#2928)

This commit is contained in:
Miguel de la Cruz 2022-04-27 18:21:26 +02:00 committed by GitHub
parent 4beea3888a
commit dc07df6bc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -131,7 +131,11 @@ CREATE TABLE {{.prefix}}boards_history (
{{if .plugin}}
{{if .postgres}}
INSERT INTO {{.prefix}}boards (
SELECT B.id, B.insert_at, C.TeamId, B.channel_id, B.created_by, B.modified_by, C.type,
SELECT B.id, B.insert_at, C.TeamId, B.channel_id, B.created_by, B.modified_by,
CASE
WHEN C.type = 'O' THEN 'O'
ELSE 'P'
END,
COALESCE(B.title, ''),
(B.fields->>'description')::text,
B.fields->>'icon',
@ -145,7 +149,11 @@ CREATE TABLE {{.prefix}}boards_history (
WHERE B.type='board'
);
INSERT INTO {{.prefix}}boards_history (
SELECT B.id, B.insert_at, C.TeamId, B.channel_id, B.created_by, B.modified_by, C.type,
SELECT B.id, B.insert_at, C.TeamId, B.channel_id, B.created_by, B.modified_by,
CASE
WHEN C.type = 'O' THEN 'O'
ELSE 'P'
END,
COALESCE(B.title, ''),
(B.fields->>'description')::text,
B.fields->>'icon',
@ -161,7 +169,11 @@ CREATE TABLE {{.prefix}}boards_history (
{{end}}
{{if .mysql}}
INSERT INTO {{.prefix}}boards (
SELECT B.id, B.insert_at, C.TeamId, B.channel_id, B.created_by, B.modified_by, C.Type,
SELECT B.id, B.insert_at, C.TeamId, B.channel_id, B.created_by, B.modified_by,
CASE
WHEN C.Type = 'O' THEN 'O'
ELSE 'P'
END,
COALESCE(B.title, ''),
JSON_UNQUOTE(JSON_EXTRACT(B.fields,'$.description')),
JSON_UNQUOTE(JSON_EXTRACT(B.fields,'$.icon')),
@ -175,7 +187,11 @@ CREATE TABLE {{.prefix}}boards_history (
WHERE B.type='board'
);
INSERT INTO {{.prefix}}boards_history (
SELECT B.id, B.insert_at, C.TeamId, B.channel_id, B.created_by, B.modified_by, C.Type,
SELECT B.id, B.insert_at, C.TeamId, B.channel_id, B.created_by, B.modified_by,
CASE
WHEN C.Type = 'O' THEN 'O'
ELSE 'P'
END,
COALESCE(B.title, ''),
JSON_UNQUOTE(JSON_EXTRACT(B.fields,'$.description')),
JSON_UNQUOTE(JSON_EXTRACT(B.fields,'$.icon')),