Fix migration script for migrations to 0.11 (#5773)

This commit is contained in:
Vivek Ratnavel Subramanian 2022-06-30 00:38:24 -07:00 committed by GitHub
parent f7a10fe5a6
commit e826c98acf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

View File

@ -28,7 +28,7 @@ CREATE TABLE IF NOT EXISTS mlmodel_service_entity (
UNIQUE (name)
);
UPDATE thread_entity SET json = JSON_SET(json, '$.type', 'Conversation');
UPDATE thread_entity SET json = JSON_SET(json, '$.type', 'Conversation', '$.reactions', JSON_ARRAY());
ALTER TABLE thread_entity
ADD type VARCHAR(64) GENERATED ALWAYS AS (json ->> '$.type'),

View File

@ -30,6 +30,9 @@ CREATE TABLE IF NOT EXISTS mlmodel_service_entity (
UPDATE thread_entity
SET json = jsonb_set(json, '{type}', '"Conversation"', true);
update thread_entity
SET json = jsonb_set(json, '{reactions}', '[]'::jsonb, true);
ALTER TABLE thread_entity
ADD type VARCHAR(64) GENERATED ALWAYS AS (json ->> 'type') STORED NOT NULL,
ADD taskId INT GENERATED ALWAYS AS ((json#>'{task,id}')::integer) STORED,

View File

@ -720,6 +720,7 @@ public class FeedRepository {
restorePatchAttributes(original, updated);
if (!updated.getReactions().isEmpty()) {
populateUserReactions(updated.getReactions());
updated
.getReactions()
.forEach(