Revert "backend: improve removeMentionedRemoteUsersColumn revert query (#403)"
This reverts commit 3473442875
.
This commit is contained in:
parent
9fd9eb0100
commit
e4a72bbfe5
1 changed files with 1 additions and 9 deletions
|
@ -13,16 +13,8 @@ export class RemoveMentionedUsersColumn1710688552234
|
|||
await queryRunner.query(
|
||||
`ALTER TABLE "note" ADD "mentionedRemoteUsers" TEXT NOT NULL DEFAULT '[]'::text`,
|
||||
);
|
||||
await queryRunner.query(`CREATE TEMP TABLE IF NOT EXISTS "temp_mentions" AS
|
||||
SELECT "id", "url", "uri", "username", "host"
|
||||
FROM "user"
|
||||
JOIN "user_profile" ON "user"."id" = "user_profile". "userId" WHERE "user"."host" IS NOT NULL`);
|
||||
await queryRunner.query(
|
||||
`CREATE UNIQUE INDEX "temp_mentions_id" ON "temp_mentions"("id")`,
|
||||
`UPDATE "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")`,
|
||||
);
|
||||
await queryRunner.query(`UPDATE "note" SET "mentionedRemoteUsers" = (
|
||||
SELECT COALESCE(json_agg(row_to_json("data")::jsonb - 'id')::text, '[]') FROM "temp_mentions" AS "data"
|
||||
WHERE "data"."id" = ANY("note"."mentions")
|
||||
)`);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue