This commit is contained in:
parent
f33656b303
commit
549b6d2dac
|
@ -0,0 +1,6 @@
|
|||
misskey=# SELECT id, username, "isRoot" from "user" WHERE host IS NULL;
|
||||
id | username | isRoot
|
||||
------------+-------------+--------
|
||||
98wzsyrur6 | relay.actor | f
|
||||
9n1njqolcd | root | f
|
||||
9n342nasd3 | marko | t
|
|
@ -0,0 +1,4 @@
|
|||
misskey=# BEGIN;
|
||||
UPDATE "user" SET "isRoot" = true WHERE id = '9n1njqolcd';
|
||||
UPDATE "user" SET "isRoot" = false WHERE id = '9n342nasd3';
|
||||
COMMIT;
|
BIN
content/posts/migrate_misskey_root_account/hero.jpg
Normal file
BIN
content/posts/migrate_misskey_root_account/hero.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 203 KiB |
55
content/posts/migrate_misskey_root_account/index.adoc
Normal file
55
content/posts/migrate_misskey_root_account/index.adoc
Normal file
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
title: Migrate Misskey root account
|
||||
date: 2023-12-10T11:41:08+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] and
|
||||
I encountered an issue that I did not find documented elsewhere, so
|
||||
I thought I'd write down the solution I found, in case anyone would
|
||||
benefit from it and save some time in the future.
|
||||
|
||||
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.
|
||||
|
||||
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".
|
||||
|
||||
== 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'.
|
||||
|
||||
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
|
||||
|
||||
[source]
|
||||
----
|
||||
include::code/query_users[]
|
||||
----
|
||||
|
||||
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.
|
||||
|
||||
[source]
|
||||
----
|
||||
include::code/update_users[]
|
||||
----
|
||||
|
||||
You should probably check that you only modified 2 rows before committing the
|
||||
transaction.
|
||||
|
||||
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.
|
||||
|
||||
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,
|
||||
you can also use the comments below if you have any issues with this
|
||||
process and I will try to help you out.
|
57
content/posts/migrate_misskey_root_account/index.fi.adoc
Normal file
57
content/posts/migrate_misskey_root_account/index.fi.adoc
Normal file
|
@ -0,0 +1,57 @@
|
|||
---
|
||||
title: Misskeyn root-tilin migraatio
|
||||
date: 2023-12-10T11:41:08+02:00
|
||||
---
|
||||
:toc:
|
||||
= Misskeyn root-tilin migraatio
|
||||
|
||||
Vaihdoin äskettäin yhden käyttäjän Fediverse-palvelimeni
|
||||
https://misskey-hub.net[Misskey]stä https://joinfirefish.org[Firefish]in ja
|
||||
kohtasin ongelman, jota en löytänyt dokumentoituna muualla. Päätin jakaa
|
||||
löytämäni ratkaisun, jos joku muu hyötyisi siitä ja säästäisi aikaansa
|
||||
tulevaisuudessa.
|
||||
|
||||
Päätin samalla siirtyä uuteen verkkotunnukseen, joten helpoin tapa oli luoda
|
||||
uusi palvelin ja migratoida käyttäjätili sen sijaan, että vaivautuisin
|
||||
migratoimaan koko Misskey-instanssia.
|
||||
|
||||
Koska kyseessä oli yhden käyttäjän instanssi, tili oli myös Misskeyn "root"
|
||||
tili. Misskey ei salli root-tilin siirtämistä, ja jos yrität, saat virheen
|
||||
"root cannot migrate" tai jotain sinne päin.
|
||||
|
||||
== Ratkaisu
|
||||
|
||||
Menin tietokantaan selvittääkseni, mitä voisin tehdä ohittamalla
|
||||
käyttöliittymän, ja kas, löysin `isRoot`-sarakkeen `user`-taulusta. En
|
||||
kuitenkaan halunnut jäädä ilman root-tiliä vanhassa instanssissani,
|
||||
joten menin Misskeyn hallintapaneeliin ja loin uuden tilin, yksinkertaisesti
|
||||
nimeltään 'root'.
|
||||
|
||||
Misskey näyttää tallentavan kaikki tunnetut käyttäjät `user`-tauluun, ei vain
|
||||
varsinaisia paikallia käyttäjätilejä. Paikallisten tilien löytämiseksi voit
|
||||
käyttää seuraavaa kyselyä
|
||||
|
||||
[source]
|
||||
----
|
||||
include::code/query_users[]
|
||||
----
|
||||
|
||||
Nyt voit yksinkertaisesti asettaa uuden root-tilin `isRoot`-sarakkeen arvoksi
|
||||
`true` ja oman käyttäjätilin arvoksi `false`. Sen jälkeen migraation pitäisi
|
||||
toimia.
|
||||
|
||||
[source]
|
||||
----
|
||||
include::code/update_users[]
|
||||
----
|
||||
|
||||
Kannattaa varmistaa, että muutit vain 2 riviä ennen kuin kommitoit
|
||||
transaktion.
|
||||
|
||||
Olettaisin, että tämä ratkaisu toimii myös Misskey forkeissa, mutta en ole
|
||||
testannut.
|
||||
|
||||
Jos tästä postauksesta oli sinulle hyötyä, muist jakaa, twiitata, tuutata ja
|
||||
piippailla se haluamassasi sosiaalisen median palvelussa. Jos sinulla on
|
||||
ongelmia tässä prosessissa, voit myös käyttää alla olevaa kommenttikenttää,
|
||||
niin voin yrittää auttaa.
|
Loading…
Reference in a new issue