2023-08-21 08:14:53 -06:00
# 🚚 Migrating from Misskey/FoundKey to Iceshrimp
2023-02-20 13:13:55 -07:00
2023-07-11 16:05:43 -06:00
All the guides below assume you're starting in the root of the repo directory.
2023-05-02 17:53:57 -06:00
2023-07-11 16:05:43 -06: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-02 17:53:57 -06:00
2023-02-20 13:13:55 -07:00
## Misskey v13 and above
2023-05-02 17:53:57 -06:00
Tested with Misskey v13.11.3.
If your Misskey v13 is older, we recommend updating your Misskey to v13.11.3.
2023-02-20 13:13:55 -07:00
```sh
2023-08-21 08:14:53 -06:00
wget -O mkv13.patch https://iceshrimp.dev/iceshrimp/iceshrimp/raw/branch/dev/docs/mkv13.patch
wget -O mkv13_restore.patch https://iceshrimp.dev/iceshrimp/iceshrimp/raw/branch/dev/docs/mkv13_restore.patch
2023-05-02 17:53:57 -06:00
git apply mkv13.patch mkv13_restore.patch
2023-02-20 13:13:55 -07:00
cd packages/backend
2023-05-02 17:53:57 -06: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-20 13:13:55 -07:00
2023-05-02 17:53:57 -06:00
for i in $(seq 1 $NUM_MIGRATIONS); do pnpm typeorm migration:revert -d ormconfig.js; done
cd ../../
2023-02-20 13:13:55 -07:00
2023-08-21 08:14:53 -06:00
git remote set-url origin https://iceshrimp.dev/iceshrimp/iceshrimp.git
2023-05-02 17:53:57 -06:00
git fetch origin
git stash push
rm -rf fluent-emojis misskey-assets
2023-12-11 07:52:48 -07:00
git checkout v2023.11.4 # or any other tag or dev
2023-08-21 08:14:53 -06:00
wget -O renote_muting.patch https://iceshrimp.dev/iceshrimp/iceshrimp/raw/branch/dev/docs/renote_muting.patch
2023-05-02 17:53:57 -06:00
git apply renote_muting.patch
2023-02-25 11:08:37 -07:00
2023-12-11 07:52:48 -07:00
# build and migrate using preferred method
2023-05-02 17:53:57 -06:00
git stash push
2023-02-20 13:13:55 -07:00
```
2023-03-29 15:10:00 -06: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-08-21 08:14:53 -06:00
then quit with `\q` , and restart Iceshrimp.
2023-03-29 15:11:01 -06:00
2023-05-02 17:53:57 -06:00
Note: Ignore errors of `column "xxx" of relation "xxx" already exists` .
2023-08-21 08:14:53 -06:00
If no other errors happened, your Iceshrimp is ready to launch!
2023-05-02 17:53:57 -06:00
2023-02-20 13:13:55 -07:00
## Misskey v12.119 and before
```sh
2023-08-21 08:14:53 -06:00
git remote set-url origin https://iceshrimp.dev/iceshrimp/iceshrimp.git
2023-02-20 13:13:55 -07:00
git fetch
2023-12-11 07:52:48 -07:00
git checkout v2023.11.4 # or any other tag or dev
2023-02-25 11:08:37 -07:00
2023-12-11 07:52:48 -07:00
# build and run migrations using preferred method
2023-02-20 13:13:55 -07:00
```
2023-07-11 16:05:43 -06:00
## FoundKey
2023-02-20 13:13:55 -07:00
```sh
2023-08-21 08:14:53 -06:00
wget -O fk.patch https://iceshrimp.dev/iceshrimp/iceshrimp/raw/branch/dev/docs/fk.patch
2023-07-17 18:45:53 -06:00
git apply fk.patch
2023-07-18 00:52:08 -06:00
cd packages/backend
2023-12-11 07:52:48 -07:00
```
2023-02-20 13:13:55 -07:00
2023-12-11 07:52:48 -07:00
Run `npx typeorm migration:revert -d ormconfig.js` for every migration until you see that `uniformThemecolor1652859567549` has been reverted. Command will not terminate properly after reverting, so you'll have to Ctrl-C
2023-02-20 13:13:55 -07:00
2023-12-11 07:52:48 -07:00
```
2023-08-21 08:14:53 -06:00
git remote set-url origin https://iceshrimp.dev/iceshrimp/iceshrimp.git
2023-02-20 13:13:55 -07:00
git fetch
2023-12-11 07:52:48 -07:00
git checkout v2023.11.4 # or any other tag or dev
2023-02-25 11:08:37 -07:00
2023-12-11 07:52:48 -07:00
# build and migrate using preferred method
2023-02-20 13:13:55 -07:00
```
2023-03-30 20:34:42 -06:00
2023-12-11 07:52:48 -07:00
## Firefish
Run `docker exec -it firefish_web /bin/sh` if using docker, before doing reverts.
2023-12-11 08:10:14 -07:00
Go to `packages/backend` , revert migrations manually using `pnpm run revertmigration:typeorm` for every migration, until `FirefishRepo1689957674000` has been reverted. Command will not terminate properly after reverting, so you'll have to Ctrl-C.
If you are migrating from versions newer than 1.0.3, you'll also have to run `pnpm run revertmigration:cargo` for every migration, until `m20230806_170616_fix_antenna_stream_ids` has been reverted.
2023-12-11 07:52:48 -07:00
Build and run migrations using your preferred method.
### Troubleshooting
If migration `IncreaseHostCharLimit1692374635734` failed to revert, please run `DELETE FROM "migrations" WHERE "name" = 'IncreaseHostCharLimit1692374635734';`
2023-03-30 20:34:42 -06:00
## Reverse
2023-12-11 07:52:48 -07:00
You ** *cannot*** migrate back to Misskey from Iceshrimp due to re-hashing passwords on signin with argon2, however theoretically you should be able to migrate from Iceshrimp to Firefish. You can migrate from Iceshrimp to FoundKey, although this is not recommended due to FoundKey being end-of-life, and may have some problems with alt-text.