From 02042b40cbff82308c449d891313f3755984a484 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Mon, 20 Feb 2023 12:13:55 -0800 Subject: [PATCH] =?UTF-8?q?docs:=20=F0=9F=93=9D=20migration=20from=20mk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 ++---- docker-README.md => docs/docker.md | 0 docs/migrate.md | 51 ++++++++++++++++++++++++++++++ docs/mkv13.patch | 45 ++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 7 deletions(-) rename docker-README.md => docs/docker.md (100%) create mode 100644 docs/migrate.md create mode 100644 docs/mkv13.patch diff --git a/README.md b/README.md index 55f599235..c4fdcf5c6 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ If you have access to a server that supports one of the sources below, I recomme ### 🐋 Docker -[How to run Calckey with Docker](./docker-README.md). +[How to run Calckey with Docker](./docs/docker.md). ## 🧑‍💻 Dependencies @@ -136,12 +136,7 @@ psql postgres -c "create database calckey with encoding = 'UTF8';" ## 🚚 Migrating from Misskey to Calckey -> ⚠️ Because of their changes, migrating from Foundkey is not supported. - -```sh -cp ../misskey/.config/default.yml ./.config/default.yml # replace `../misskey/` with misskey path, add `docker.env` if you use Docker -cp -r ../misskey/files . -``` +For migrating from Misskey v13, Misskey v12, and Foundkey, read [this document](./docs/migrate.md). ## 🍀 NGINX diff --git a/docker-README.md b/docs/docker.md similarity index 100% rename from docker-README.md rename to docs/docker.md diff --git a/docs/migrate.md b/docs/migrate.md new file mode 100644 index 000000000..990ccf35e --- /dev/null +++ b/docs/migrate.md @@ -0,0 +1,51 @@ +# 🚚 Migrating from Misskey to Calckey + +## Misskey v13 and above + +```sh +git apply docs/mkv13.patch + +cd packages/backend + +LINE_NUM="$(npx typeorm migration:show -d ormconfig.js | grep -n activeEmailValidation1657346559800 | cut -d ':' -f 1)" +NUM_MIGRATIONS="$(npx typeorm migration:show -d ormconfig.js | tail -n+"$LINE_NUM" | grep '\[X\]' | nl)" + +for i in $(seq 1 $NUM_MIGRAIONS); do + npx typeorm migration:revert -d ormconfig.js +done + +git remote set-url origin https://codeberg.org/calckey/calckey.git +git fetch +git checkout main # or beta or develop +git pull --ff +# build using prefered method +``` + +## Misskey v12.119 and before + +```sh +git remote set-url origin https://codeberg.org/calckey/calckey.git +git fetch +git checkout main # or beta or develop +git pull --ff +# build using prefered method +``` + +## Foundkey + +```sh +cd packages/backend + +LINE_NUM="$(npx typeorm migration:show -d ormconfig.js | grep -n uniformThemecolor1652859567549 | cut -d ':' -f 1)" +NUM_MIGRATIONS="$(npx typeorm migration:show -d ormconfig.js | tail -n+"$LINE_NUM" | grep '\[X\]' | nl)" + +for i in $(seq 1 $NUM_MIGRAIONS); do + npx typeorm migration:revert -d ormconfig.js +done + +git remote set-url origin https://codeberg.org/calckey/calckey.git +git fetch +git checkout main # or beta or develop +git pull --ff +# build using prefered method +``` diff --git a/docs/mkv13.patch b/docs/mkv13.patch new file mode 100644 index 000000000..e6106b16f --- /dev/null +++ b/docs/mkv13.patch @@ -0,0 +1,45 @@ +diff --git a/packages/backend/migration/1672704017999-remove-lastCommunicatedAt.js b/packages/backend/migration/1672704017999-remove-lastCommunicatedAt.js +index 38a676985..c4ae690e0 100644 +--- a/packages/backend/migration/1672704017999-remove-lastCommunicatedAt.js ++++ b/packages/backend/migration/1672704017999-remove-lastCommunicatedAt.js +@@ -6,6 +6,8 @@ export class removeLastCommunicatedAt1672704017999 { + } + + async down(queryRunner) { +- await queryRunner.query(`ALTER TABLE "instance" ADD "lastCommunicatedAt" TIMESTAMP WITH TIME ZONE NOT NULL`); ++ await queryRunner.query(`ALTER TABLE "instance" ADD "lastCommunicatedAt" TIMESTAMP WITH TIME ZONE`); ++ await queryRunner.query(`UPDATE "instance" SET "lastCommunicatedAt" = COALESCE("infoUpdatedAt", "caughtAt")`); ++ await queryRunner.query(`ALTER TABLE "instance" ALTER COLUMN "lastCommunicatedAt" SET NOT NULL`); + } + } +diff --git a/packages/backend/migration/1673336077243-PollChoiceLength.js b/packages/backend/migration/1673336077243-PollChoiceLength.js +index 810c626e0..5809528cb 100644 +--- a/packages/backend/migration/1673336077243-PollChoiceLength.js ++++ b/packages/backend/migration/1673336077243-PollChoiceLength.js +@@ -6,6 +6,6 @@ export class PollChoiceLength1673336077243 { + } + + async down(queryRunner) { +- await queryRunner.query(`ALTER TABLE "poll" ALTER COLUMN "choices" TYPE character varying(128) array`); ++ //await queryRunner.query(`ALTER TABLE "poll" ALTER COLUMN "choices" TYPE character varying(128) array`); + } + } +diff --git a/packages/backend/migration/1674118260469-achievement.js b/packages/backend/migration/1674118260469-achievement.js +index 131ab96f8..57a922f83 100644 +--- a/packages/backend/migration/1674118260469-achievement.js ++++ b/packages/backend/migration/1674118260469-achievement.js +@@ -18,12 +18,13 @@ export class achievement1674118260469 { + + async down(queryRunner) { + await queryRunner.query(`CREATE TYPE "public"."user_profile_mutingnotificationtypes_enum_old" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app', 'pollEnded')`); ++ await queryRunner.query(`CREATE TYPE "public"."notification_type_enum_old" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`); + await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "mutingNotificationTypes" DROP DEFAULT`); + await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "mutingNotificationTypes" TYPE "public"."user_profile_mutingnotificationtypes_enum_old"[] USING "mutingNotificationTypes"::"text"::"public"."user_profile_mutingnotificationtypes_enum_old"[]`); + await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "mutingNotificationTypes" SET DEFAULT '{}'`); + await queryRunner.query(`DROP TYPE "public"."user_profile_mutingnotificationtypes_enum"`); + await queryRunner.query(`ALTER TYPE "public"."user_profile_mutingnotificationtypes_enum_old" RENAME TO "user_profile_mutingnotificationtypes_enum"`); +- await queryRunner.query(`CREATE TYPE "public"."notification_type_enum_old" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`); ++ await queryRunner.query(`DELETE FROM "public"."notification" WHERE "type" = 'achievementEarned'`); + await queryRunner.query(`ALTER TABLE "notification" ALTER COLUMN "type" TYPE "public"."notification_type_enum_old" USING "type"::"text"::"public"."notification_type_enum_old"`); + await queryRunner.query(`DROP TYPE "public"."notification_type_enum"`); + await queryRunner.query(`ALTER TYPE "public"."notification_type_enum_old" RENAME TO "notification_type_enum"`);