From 39a4eea08e28e566fcf90aedd225315226d19d75 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Thu, 25 Aug 2022 09:22:25 +0200 Subject: [PATCH] fix migration --- .../1661376843000-remove-mentioned-remote-users-column.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/migration/1661376843000-remove-mentioned-remote-users-column.js b/packages/backend/migration/1661376843000-remove-mentioned-remote-users-column.js index 7df859ada..f4e8d30e5 100644 --- a/packages/backend/migration/1661376843000-remove-mentioned-remote-users-column.js +++ b/packages/backend/migration/1661376843000-remove-mentioned-remote-users-column.js @@ -7,6 +7,6 @@ export class removeMentionedRemoteUsersColumn1661376843000 { async down(queryRunner) { await queryRunner.query(`ALTER TABLE "note" ADD "mentionedRemoteUsers" TEXT NOT NULL DEFAULT '[]'::text`); - await queryRunner.query(`UPDATE TABLE "note" SET "mentionedRemoteUsers = (SELECT json_agg(row_to_json("data")) FROM (SELECT "url", "uri", "username", "host" FROM "user" JOIN "user_profile" ON "user"."id" = "user_profile". "userId" WHERE "user"."id" IN "note"."mentions") AS "data")`); + await queryRunner.query(`UPDATE TABLE "note" SET "mentionedRemoteUsers" = (SELECT COALESCE(json_agg(row_to_json("data"))::text, '[]') FROM (SELECT "url", "uri", "username", "host" FROM "user" JOIN "user_profile" ON "user"."id" = "user_profile". "userId" WHERE "user"."host" IS NOT NULL AND "user"."id" = ANY("note"."mentions")) AS "data")`); } }