From 26ccb2c17484d28b274b2b395ddadb90fb2283af Mon Sep 17 00:00:00 2001 From: riku6460 <17585784+riku6460@users.noreply.github.com> Date: Sat, 21 Oct 2023 04:47:06 +0900 Subject: [PATCH] =?UTF-8?q?5=E5=84=84=E5=B9=B4=E3=81=8B=E3=81=8B=E3=82=8B?= =?UTF-8?q?=E3=83=9E=E3=82=A4=E3=82=B0=E3=83=AC=E3=82=92=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=20(MisskeyIO#190)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/migration/1696807733453-userListUserId.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/backend/migration/1696807733453-userListUserId.js b/packages/backend/migration/1696807733453-userListUserId.js index ab2ba07fb5..e897da0358 100644 --- a/packages/backend/migration/1696807733453-userListUserId.js +++ b/packages/backend/migration/1696807733453-userListUserId.js @@ -8,11 +8,7 @@ export class UserListUserId1696807733453 { async up(queryRunner) { await queryRunner.query(`ALTER TABLE "user_list_membership" ADD "userListUserId" character varying(32) NOT NULL DEFAULT ''`); - const memberships = await queryRunner.query(`SELECT "id", "userListId" FROM "user_list_membership"`); - for(let i = 0; i < memberships.length; i++) { - const userList = await queryRunner.query(`SELECT "userId" FROM "user_list" WHERE "id" = $1`, [memberships[i].userListId]); - await queryRunner.query(`UPDATE "user_list_membership" SET "userListUserId" = $1 WHERE "id" = $2`, [userList[0].userId, memberships[i].id]); - } + await queryRunner.query(`UPDATE "user_list_membership" SET "userListUserId" = "user_list"."userId" FROM "user_list" WHERE "user_list_membership"."userListId" = "user_list"."id"`); } async down(queryRunner) {