From bb341b860514a27b7a2222ec16eefde2041b93c0 Mon Sep 17 00:00:00 2001 From: naskya Date: Wed, 4 Oct 2023 18:18:06 +0900 Subject: [PATCH] dev: change revert instruction --- README.md | 12 ++---------- neko/revert.sql | 3 +++ .../9999999999999-emoji-moderator.js | 17 ----------------- 3 files changed, 5 insertions(+), 27 deletions(-) create mode 100644 neko/revert.sql delete mode 100644 packages/backend/migration-neko-revert/9999999999999-emoji-moderator.js diff --git a/README.md b/README.md index 9c4144df4..eb2c46744 100644 --- a/README.md +++ b/README.md @@ -196,17 +196,9 @@ Repository url where you want to install: ```sh $ cd /home/calckey/calckey ``` -1. `packages/backend/ormconfig.js` をテキストエディターで開き、`migrations` に `migration-neko-revert/*.js` を追加する +1. このフォークで加えられたデータベースへの変更を取り消す(`dbname`(以下の例では `mk1`)には `.config/default.yml` に記載されている PostgreSQL のデータベース名(`db:` の後に書かれているもの)を指定する) ```sh - $ vim packages/backend/ormconfig.js - ``` - ```diff - - migrations: ["migration/*.js", "migration-neko/*.js"], - + migrations: ["migration/*.js", "migration-neko/*.js", "migration-neko-revert/*.js"], - ``` -1. このフォークで加えられたデータベースへの変更を取り消す - ```sh - $ pnpm run migrate + $ sudo -iu postgres psql --dbname=mk1 --file=neko/revert.sql ``` 1. Firefish がインストールされているディレクトリの親ディレクトリ (e.g., `/home/calckey`) に行く ```sh diff --git a/neko/revert.sql b/neko/revert.sql new file mode 100644 index 000000000..4a94496a6 --- /dev/null +++ b/neko/revert.sql @@ -0,0 +1,3 @@ +-- emoji-moderator +ALTER TABLE "user" DROP COLUMN "emojiModPerm"; +DROP TYPE "public"."user_emojimodperm_enum"; diff --git a/packages/backend/migration-neko-revert/9999999999999-emoji-moderator.js b/packages/backend/migration-neko-revert/9999999999999-emoji-moderator.js deleted file mode 100644 index b1d6220b0..000000000 --- a/packages/backend/migration-neko-revert/9999999999999-emoji-moderator.js +++ /dev/null @@ -1,17 +0,0 @@ -export class EmojiModeratorRevert9999999999999 { - name = "EmojiModeratorRevert9999999999999"; - - async down(queryRunner) { - await queryRunner.query( - `CREATE TYPE "public"."user_emojimodperm_enum" AS ENUM('none', 'add', 'mod', 'full')`, - ); - await queryRunner.query( - `ALTER TABLE "user" ADD "emojiModPerm" "public"."user_emojimodperm_enum" NOT NULL DEFAULT 'none'`, - ); - } - - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "emojiModPerm"`); - await queryRunner.query(`DROP TYPE "public"."user_emojimodperm_enum"`); - } -}