From 80923710ec450e239f6bbbb943f667d0bf7451c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BE=E3=81=A3=E3=81=A1=E3=82=83=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Tue, 23 Jan 2024 21:15:23 +0900 Subject: [PATCH] =?UTF-8?q?fix(migration):=20DB=E3=81=AE=E3=83=9E=E3=82=A4?= =?UTF-8?q?=E3=82=B0=E3=83=AC=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3=E3=81=AE?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20(MisskeyIO#375)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/migration/1705475608437-reversi.js | 10 ++-------- .../1706011243939-UserProfileBirthdayIndex.js | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 packages/backend/migration/1706011243939-UserProfileBirthdayIndex.js diff --git a/packages/backend/migration/1705475608437-reversi.js b/packages/backend/migration/1705475608437-reversi.js index 45d8c614be..4d7416d1b3 100644 --- a/packages/backend/migration/1705475608437-reversi.js +++ b/packages/backend/migration/1705475608437-reversi.js @@ -7,16 +7,10 @@ export class Reversi1705475608437 { name = 'Reversi1705475608437' async up(queryRunner) { - // await queryRunner.query(`DROP INDEX "public"."IDX_b46ec40746efceac604142be1c"`); - // await queryRunner.query(`DROP INDEX "public"."IDX_b604d92d6c7aec38627f6eaf16"`); - // await queryRunner.query(`ALTER TABLE "reversi_game" DROP COLUMN "createdAt"`); - // await queryRunner.query(`ALTER TABLE "reversi_matching" DROP COLUMN "createdAt"`); + await queryRunner.query(`ALTER TABLE "reversi_game" ALTER COLUMN "createdAt" SET DEFAULT now()`); } async down(queryRunner) { - // await queryRunner.query(`ALTER TABLE "reversi_matching" ADD "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL`); - // await queryRunner.query(`ALTER TABLE "reversi_game" ADD "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL`); - // await queryRunner.query(`CREATE INDEX "IDX_b604d92d6c7aec38627f6eaf16" ON "reversi_matching" ("createdAt") `); - // await queryRunner.query(`CREATE INDEX "IDX_b46ec40746efceac604142be1c" ON "reversi_game" ("createdAt") `); + await queryRunner.query(`ALTER TABLE "reversi_game" ALTER COLUMN "createdAt" DROP DEFAULT`); } } diff --git a/packages/backend/migration/1706011243939-UserProfileBirthdayIndex.js b/packages/backend/migration/1706011243939-UserProfileBirthdayIndex.js new file mode 100644 index 0000000000..d90d5832b0 --- /dev/null +++ b/packages/backend/migration/1706011243939-UserProfileBirthdayIndex.js @@ -0,0 +1,16 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export class UserProfileBirthdayIndex1706011243939 { + name = 'UserProfileBirthdayIndex1706011243939' + + async up(queryRunner) { + await queryRunner.query(`CREATE INDEX "IDX_58699f75b9cf904f5f007909cb" ON "user_profile" ("birthday") `); + } + + async down(queryRunner) { + await queryRunner.query(`DROP INDEX "public"."IDX_58699f75b9cf904f5f007909cb"`); + } +}