mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-10 03:17:51 +00:00
Adapt some migrations so they can be rolled back
This is useful for people who want to migrate back to Pleroma. It's also added in the docs, but also noted that this is barely tested and to be used at their own risk.
This commit is contained in:
parent
fb8081e1a3
commit
3a13f91fff
4 changed files with 36 additions and 4 deletions
|
@ -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.
|
||||
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
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue