[MM-45444] Denormalize Reactions to add ChannelId for top reactions insights query (#20572)

* Denormalize Reactions to add ChannelId for top reactions insights query

* Remove hardcoded timestamps

* Fix store, api4 tests for reactions

* Fix tests

* Fix integrity tests, allow reaction to have ChannelId populated before calling store function

* Lint fixes

* Add ChannelId field to BulkGetForPosts, Delete store handlers

* Add index to mysql migration, add not null characteristic without a separate command

* Select channelId instead of fetching post via store.GetPost, add if exists to drop column

* Make updating of Reactions conditional to support pre-migration

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Shivashis Padhi
2022-07-11 18:55:03 +05:30
коммит произвёл GitHub
родитель 7bbf30d6bc
Коммит 20d690b412
9 изменённых файлов: 148 добавлений и 29 удалений

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

@@ -0,0 +1 @@
ALTER TABLE reactions DROP COLUMN IF EXISTS channelid;

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

@@ -0,0 +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='';
CREATE INDEX IF NOT EXISTS idx_reactions_channel_id on reactions (channelid);