Coalesce migration of Reactions.ChannelId to '' if Post does not exist. (#20643)

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Martin Kraft
2022-07-13 10:19:59 -04:00
коммит произвёл GitHub
родитель 059ea7eb44
Коммит 5c929c4952
2 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@@ -14,7 +14,7 @@ EXECUTE addColumnIfNotExists;
DEALLOCATE PREPARE addColumnIfNotExists;
UPDATE Reactions SET ChannelId = (select ChannelId from Posts where Posts.Id = Reactions.PostId) WHERE ChannelId="";
UPDATE Reactions SET ChannelId = COALESCE((select ChannelId from Posts where Posts.Id = Reactions.PostId), '') WHERE ChannelId="";
SET @preparedStatement = (SELECT IF(

Просмотреть файл

@@ -1,3 +1,3 @@
ALTER TABLE reactions ADD COLUMN IF NOT EXISTS channelid varchar(26) NOT NULL DEFAULT '';
UPDATE reactions SET channelid = (select channelid from posts where posts.id = reactions.postid) WHERE channelid='';
UPDATE reactions SET channelid = COALESCE((select channelid from posts where posts.id = reactions.postid), '') WHERE channelid='';
CREATE INDEX IF NOT EXISTS idx_reactions_channel_id on reactions (channelid);