2023-07-16 06:21:17 +09:00
# 🚚 Migrating from Misskey/FoundKey to Firefish
2023-02-21 05:13:55 +09:00
2023-07-12 07:05:43 +09:00
All the guides below assume you're starting in the root of the repo directory.
2023-05-03 08:53:57 +09:00
2023-07-12 07:05:43 +09:00
### Before proceeding
- **Ensure you have stopped all master and worker processes of Misskey.**
- **Ensure you have backups of the database before performing any commands.**
2023-05-03 08:53:57 +09:00
2023-02-21 05:13:55 +09:00
## Misskey v13 and above
2023-05-03 08:53:57 +09:00
Tested with Misskey v13.11.3.
If your Misskey v13 is older, we recommend updating your Misskey to v13.11.3.
2023-02-21 05:13:55 +09:00
```sh
2023-07-22 01:44:29 +09:00
wget -O mkv13.patch https://git.joinfirefish.org/firefish/firefish/-/raw/develop/docs/mkv13.patch
wget -O mkv13_restore.patch https://git.joinfirefish.org/firefish/firefish/-/raw/develop/docs/mkv13_restore.patch
2023-05-03 08:53:57 +09:00
git apply mkv13.patch mkv13_restore.patch
2023-02-21 05:13:55 +09:00
cd packages/backend
2023-05-03 08:53:57 +09:00
LINE_NUM="$(pnpm typeorm migration:show -d ormconfig.js | grep -n activeEmailValidation1657346559800 | cut -d ':' -f 1)"
NUM_MIGRATIONS="$(pnpm typeorm migration:show -d ormconfig.js | tail -n+"$LINE_NUM" | grep '\[X\]' | wc -l)"
2023-02-21 05:13:55 +09:00
2023-05-03 08:53:57 +09:00
for i in $(seq 1 $NUM_MIGRATIONS); do pnpm typeorm migration:revert -d ormconfig.js; done
cd ../../
2023-02-21 05:13:55 +09:00
2023-07-22 01:44:29 +09:00
git remote set-url origin https://git.joinfirefish.org/firefish/firefish.git
2023-05-03 08:53:57 +09:00
git fetch origin
git stash push
rm -rf fluent-emojis misskey-assets
git switch main # or beta or develop
2023-02-21 05:13:55 +09:00
git pull --ff
2023-07-22 01:44:29 +09:00
wget -O renote_muting.patch https://git.joinfirefish.org/firefish/firefish/-/raw/develop/docs/renote_muting.patch
2023-05-03 08:53:57 +09:00
git apply renote_muting.patch
2023-02-26 03:08:37 +09:00
2023-05-03 08:53:57 +09:00
pnpm install
NODE_ENV=production pnpm run build
pnpm run migrate
git stash push
2023-02-21 05:13:55 +09:00
```
2023-03-30 06:10:00 +09:00
Depending on the version you're migrating from, you may have to open Postgres with `psql -d your_database` and run the following commands:
```sql
ALTER TABLE "meta" ADD COLUMN "disableLocalTimeline" boolean DEFAULT false;
ALTER TABLE "meta" ADD COLUMN "disableGlobalTimeline" boolean DEFAULT false;
ALTER TABLE "meta" ADD COLUMN "localDriveCapacityMb" integer DEFAULT 512;
ALTER TABLE "meta" ADD COLUMN "remoteDriveCapacityMb" integer DEFAULT 128;
ALTER TABLE "user" ADD COLUMN "isSilenced" boolean DEFAULT false;
ALTER TABLE "user" ADD COLUMN "isAdmin" boolean DEFAULT false;
ALTER TABLE "user" ADD COLUMN "isModerator" boolean DEFAULT false;
ALTER TABLE "user" ADD COLUMN "remoteDriveCapacityMb" integer DEFAULT 128;
ALTER TABLE "user" ADD COLUMN "driveCapacityOverrideMb" integer DEFAULT 128;
ALTER TABLE "instance" ADD COLUMN "caughtAt" date;
ALTER TABLE "instance" ADD COLUMN "latestRequestSentAt" date;
ALTER TABLE "instance" ADD COLUMN "latestStatus" character varying(512);
ALTER TABLE "instance" ADD COLUMN "lastCommunicatedAt" date;
```
2023-07-03 07:18:30 +09:00
then quit with `\q` , and restart Firefish.
2023-03-30 06:11:01 +09:00
2023-05-03 08:53:57 +09:00
Note: Ignore errors of `column "xxx" of relation "xxx" already exists` .
2023-07-03 07:18:30 +09:00
If no other errors happened, your Firefish is ready to launch!
2023-05-03 08:53:57 +09:00
2023-02-21 05:13:55 +09:00
## Misskey v12.119 and before
```sh
2023-07-22 01:44:29 +09:00
git remote set-url origin https://git.joinfirefish.org/firefish/firefish.git
2023-02-21 05:13:55 +09:00
git fetch
git checkout main # or beta or develop
git pull --ff
2023-02-26 03:08:37 +09:00
NODE_ENV=production pnpm run migrate
2023-02-21 05:13:55 +09:00
# build using prefered method
```
2023-07-12 07:05:43 +09:00
## FoundKey
2023-02-21 05:13:55 +09:00
```sh
2023-07-22 01:44:29 +09:00
wget -O fk.patch https://git.joinfirefish.org/firefish/firefish/-/raw/develop/docs/fk.patch
2023-07-18 09:45:53 +09:00
git apply fk.patch
2023-07-18 15:52:08 +09:00
cd packages/backend
2023-02-21 05:13:55 +09:00
LINE_NUM="$(npx typeorm migration:show -d ormconfig.js | grep -n uniformThemecolor1652859567549 | cut -d ':' -f 1)"
2023-07-11 01:50:54 +09:00
NUM_MIGRATIONS="$(npx typeorm migration:show -d ormconfig.js | tail -n+"$LINE_NUM" | grep '\[X\]' | wc -l)"
2023-02-21 05:13:55 +09:00
2023-07-11 01:50:54 +09:00
for i in $(seq 1 $NUM_MIGRATIONS); do
2023-02-21 05:13:55 +09:00
npx typeorm migration:revert -d ormconfig.js
done
2023-07-22 01:44:29 +09:00
git remote set-url origin https://git.joinfirefish.org/firefish/firefish.git
2023-02-21 05:13:55 +09:00
git fetch
git checkout main # or beta or develop
git pull --ff
2023-02-26 03:08:37 +09:00
NODE_ENV=production pnpm run migrate
2023-02-21 05:13:55 +09:00
# build using prefered method
```
2023-03-31 11:34:42 +09:00
## Reverse
2023-08-10 21:58:41 +09:00
You ** *cannot*** migrate back to Misskey from Firefish due to re-hashing passwords on signin with argon2. You can migrate from Firefish to FoundKey, although this is not recommended due to FoundKey being end-of-life, and may have some problems with alt-text.