diff --git a/docs/docs/installation/migrating_to_akkoma.md b/docs/docs/installation/migrating_to_akkoma.md index 2df7bfad0..4a58e836e 100644 --- a/docs/docs/installation/migrating_to_akkoma.md +++ b/docs/docs/installation/migrating_to_akkoma.md @@ -117,4 +117,16 @@ To fix this, run: mix pleroma.config delete pleroma frontends ``` -which will remove the config from the database. Things should work now. \ No newline at end of file +which will remove the config from the database. Things should work now. + +## Migrating back to Pleroma + +Akkoma is a hard fork of Pleroma. As such, migrating back is not guaranteed to always work. But if you want to migrate back to Pleroma, you can always try. Just note that you may run into unexpected issues and you're basically on your own. The following are some tips that may help, but note that these are barely tested, so proceed at your own risk. + +First you will need to roll back the database migrations. The latest migration both Akkoma and Pleroma still have in common should be 20210416051708, so roll back to that. If you run from source, that should be + +```sh +MIX_ENV=prod mix ecto.rollback --to 20210416051708 +``` + +Then switch back to Pleroma for updates (similar to how was done to migrate to Akkoma), and remove the front-ends. The front-ends are installed in the `frontends` folder in the [static directory](../configuration/static_dir.md). Once you are back to Pleroma, you will need to run the database migrations again. See the Pleroma documentation for this. diff --git a/priv/repo/migrations/20211125110126_force_pinned_objects_to_exist.exs b/priv/repo/migrations/20211125110126_force_pinned_objects_to_exist.exs index 1fe9271f0..c2b136d43 100644 --- a/priv/repo/migrations/20211125110126_force_pinned_objects_to_exist.exs +++ b/priv/repo/migrations/20211125110126_force_pinned_objects_to_exist.exs @@ -1,11 +1,19 @@ defmodule Pleroma.Repo.Migrations.ForcePinnedObjectsToExist do use Ecto.Migration - def change do + def up do execute("UPDATE users SET pinned_objects = '{}' WHERE pinned_objects IS NULL") alter table("users") do modify(:pinned_objects, :map, null: false, default: %{}) end end + + def down do + alter table("users") do + modify(:pinned_objects, :map, null: true, default: nil) + end + + execute("UPDATE users SET pinned_objects = NULL WHERE pinned_objects = '{}'") + end end diff --git a/priv/repo/migrations/20220108213213_add_mastofe_settings.exs b/priv/repo/migrations/20220108213213_add_mastofe_settings.exs index 1046c2894..dc7777d53 100644 --- a/priv/repo/migrations/20220108213213_add_mastofe_settings.exs +++ b/priv/repo/migrations/20220108213213_add_mastofe_settings.exs @@ -1,9 +1,15 @@ defmodule Pleroma.Repo.Migrations.AddMastofeSettings do use Ecto.Migration - def change do + def up do alter table(:users) do add_if_not_exists(:mastofe_settings, :map) end end + + def down do + alter table(:users) do + remove_if_exists(:mastofe_settings, :map) + end + end end diff --git a/priv/repo/migrations/20220302013920_add_language_to_users.exs b/priv/repo/migrations/20220302013920_add_language_to_users.exs index 7a63c36aa..fc5008993 100644 --- a/priv/repo/migrations/20220302013920_add_language_to_users.exs +++ b/priv/repo/migrations/20220302013920_add_language_to_users.exs @@ -1,9 +1,15 @@ defmodule Pleroma.Repo.Migrations.AddLanguageToUsers do use Ecto.Migration - def change do + def up do alter table(:users) do add_if_not_exists(:language, :string) end end + + def down do + alter table(:users) do + remove_if_exists(:language, :string) + end + end end