korhonen.cc/content/posts/migrate_misskey_root_account/index.adoc

50 lines
2.2 KiB
Plaintext
Raw Normal View History

2023-12-10 12:36:32 +02:00
---
title: Migrate Misskey root account
2023-12-10 14:22:17 +02:00
description: A solution for an issue I found when migrating from Misskey to Firefish
2023-12-10 12:36:32 +02:00
date: 2023-12-10T11:41:08+02:00
2023-12-10 13:35:43 +02:00
featured_image: hero.jpg
menu:
sidebar:
name: Migrate Misskey root account
identifier: migrate_misskey_root_account
2023-12-10 12:36:32 +02:00
---
:toc:
= Migrate Misskey root account
I recently migrated my single user Fediverse server from https://misskey-hub.net[Misskey] to https://joinfirefish.org[Firefish].
During the migration I encountered an issue that I did not find documented elsewhere.
I thought I'd write down the solution I found, in case anyone would benefit from it and save some time in the future.
2023-12-10 12:36:32 +02:00
I decided to migrate to a new domain at the same time, so the easiest way was just to create a new server and migrate my account and not fuss about migrating the Misskey instance itself.
2023-12-10 12:36:32 +02:00
Being a single user instance, my account was also the "root" account of Misskey.
Misskey does not allow migrating the root account, if trying to do so, you will just get an error along the lines of "root cannot migrate".
2023-12-10 12:36:32 +02:00
== Solution
I took to the database to find out what I can do bypassing the UI, and lo and behold, I found an `isRoot` column in the `user` table.
I didn't want to end up without a root account on my old instance however, so I went to the Misskey control panel and created a new account, simply called "root".
2023-12-10 12:36:32 +02:00
Misskey seems to save all of it's known users to the `user` table, not only the actual local accounts.
To find the local accounts only, you can use the following query
2023-12-10 12:36:32 +02:00
[source,sql]
2023-12-10 12:36:32 +02:00
----
include::code/query_users.sql[]
2023-12-10 12:36:32 +02:00
----
Now you can simply make your new root account's `isRoot` column `true` and your actual user account `false`.
After that, the migration will work.
2023-12-10 12:36:32 +02:00
[source,sql]
2023-12-10 12:36:32 +02:00
----
include::code/update_users.sql[]
2023-12-10 12:36:32 +02:00
----
You should probably check that you only modified 2 rows before committing the transaction.
2023-12-10 12:36:32 +02:00
I would imagine that this solution should work for the numerous Misskey forks around, but I have not tested it so your results may vary.
2023-12-10 12:36:32 +02:00
If you found this post useful, make sure to share, tweet, toot, bleep and bloop this on your social media service of choice.
If you have any issues with this process, you can leave a comment below and I will try to help you out.