forked from AkkomaGang/akkoma
Merge pull request 'Adapt some migrations so they can be rolled back' (#565) from ilja/akkoma:fix_some_migrations_for_rollback into develop
Reviewed-on: AkkomaGang/akkoma#565
This commit is contained in:
commit
4db42f5ab5
4 changed files with 36 additions and 4 deletions
|
@ -117,4 +117,16 @@ To fix this, run:
|
||||||
mix pleroma.config delete pleroma frontends
|
mix pleroma.config delete pleroma frontends
|
||||||
```
|
```
|
||||||
|
|
||||||
which will remove the config from the database. Things should work now.
|
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.
|
||||||
|
|
|
@ -1,11 +1,19 @@
|
||||||
defmodule Pleroma.Repo.Migrations.ForcePinnedObjectsToExist do
|
defmodule Pleroma.Repo.Migrations.ForcePinnedObjectsToExist do
|
||||||
use Ecto.Migration
|
use Ecto.Migration
|
||||||
|
|
||||||
def change do
|
def up do
|
||||||
execute("UPDATE users SET pinned_objects = '{}' WHERE pinned_objects IS NULL")
|
execute("UPDATE users SET pinned_objects = '{}' WHERE pinned_objects IS NULL")
|
||||||
|
|
||||||
alter table("users") do
|
alter table("users") do
|
||||||
modify(:pinned_objects, :map, null: false, default: %{})
|
modify(:pinned_objects, :map, null: false, default: %{})
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
defmodule Pleroma.Repo.Migrations.AddMastofeSettings do
|
defmodule Pleroma.Repo.Migrations.AddMastofeSettings do
|
||||||
use Ecto.Migration
|
use Ecto.Migration
|
||||||
|
|
||||||
def change do
|
def up do
|
||||||
alter table(:users) do
|
alter table(:users) do
|
||||||
add_if_not_exists(:mastofe_settings, :map)
|
add_if_not_exists(:mastofe_settings, :map)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down do
|
||||||
|
alter table(:users) do
|
||||||
|
remove_if_exists(:mastofe_settings, :map)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
defmodule Pleroma.Repo.Migrations.AddLanguageToUsers do
|
defmodule Pleroma.Repo.Migrations.AddLanguageToUsers do
|
||||||
use Ecto.Migration
|
use Ecto.Migration
|
||||||
|
|
||||||
def change do
|
def up do
|
||||||
alter table(:users) do
|
alter table(:users) do
|
||||||
add_if_not_exists(:language, :string)
|
add_if_not_exists(:language, :string)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down do
|
||||||
|
alter table(:users) do
|
||||||
|
remove_if_exists(:language, :string)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue