diff options
author | rinpatch <rinpatch@sdf.org> | 2020-07-14 12:00:53 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-07-14 13:15:46 +0300 |
commit | 8d56fb6d223995de3f753eeef9475583e2b1e6ad (patch) | |
tree | 94b1e215b15b1a055423aeea9d89af24ef6db325 /priv | |
parent | 5d215fd81f529b639db9096ca71d4e7f0a6ed386 (diff) |
Migrate in-db config after updating to Oban 2.0
Diffstat (limited to 'priv')
-rw-r--r-- | priv/repo/migrations/20200714081657_oban_2_0_config_changes.exs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/priv/repo/migrations/20200714081657_oban_2_0_config_changes.exs b/priv/repo/migrations/20200714081657_oban_2_0_config_changes.exs new file mode 100644 index 000000000..c54bb2511 --- /dev/null +++ b/priv/repo/migrations/20200714081657_oban_2_0_config_changes.exs @@ -0,0 +1,27 @@ +defmodule Elixir.Pleroma.Repo.Migrations.Oban20ConfigChanges do + use Ecto.Migration + import Ecto.Query + alias Pleroma.ConfigDB + alias Pleroma.Repo + + def change do + config_entry = + from(c in ConfigDB, where: c.group == ^":pleroma" and c.key == ^"Oban") + |> select([c], struct(c, [:value, :id])) + |> Repo.one() + + if config_entry do + %{value: value} = config_entry + + value = + case Keyword.fetch(value, :verbose) do + {:ok, log} -> Keyword.put_new(value, :log, log) + _ -> value + end + |> Keyword.drop([:verbose, :prune]) + + Ecto.Changeset.change(config_entry, %{value: value}) + |> Repo.update() + end + end +end |