Nathaniel Knight

Reflections, diversions, and opinions from a progressive ex-physicist programmer dad with a sore back.

Migrating Follows from GoToSocial to Mastodon

This article describes how to migrate your subscriptions from GotoSocial to Mastodon. I recently made this migration; I talk about my motivations here.

This procedure doesn't handle getting folks over to your new account. It will get you a list of your subscriptions that you can import with Mastodon's data import feature so you don't have to re-follow everyone by hand.

I'm not aware of an account migration or user-facing data export feature in GotoSocial, so you'll need access to your instance's database (or help from someone who has it, anyways). With those caveats out of the way, here's the procedure.

Extract your Subscriptions

To get your subscriptions (or "Follows", as the database calls them), you'll first need to get your user id:

SELECT username, id
FROM accounts
WHERE username = 'YOUR_USERNAME_HERE'

Once you've got the id, you can plug it into the following query to get your follow list:

SELECT
  accounts.username || '@' || accounts.domain
  AS 'Account address'
FROM accounts
JOIN follows ON accounts.id = follows.target_account_id
WHERE follows.account_id = 'YOUR_ID_HERE'

You'll need the results of this query as a CSV file. There are lots of ways to do that; I used the CSV export feature built into Datasette because I was already using it to figure out the data.

Upload to Mastodon

Once you've got your follows in a CSV file you should be able to import them using Mastodon's data import feature. It should be available on your Mastodon instance's Settings page under Import.