logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

20200714081657_oban_2_0_config_changes.exs (850B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Elixir.Pleroma.Repo.Migrations.Oban20ConfigChanges do
  5. use Ecto.Migration
  6. import Ecto.Query
  7. alias Pleroma.ConfigDB
  8. alias Pleroma.Repo
  9. def change do
  10. config_entry =
  11. from(c in ConfigDB, where: c.group == ^":pleroma" and c.key == ^"Oban")
  12. |> select([c], struct(c, [:value, :id]))
  13. |> Repo.one()
  14. if config_entry do
  15. %{value: value} = config_entry
  16. value =
  17. case Keyword.fetch(value, :verbose) do
  18. {:ok, log} -> Keyword.put_new(value, :log, log)
  19. _ -> value
  20. end
  21. |> Keyword.drop([:verbose, :prune])
  22. Ecto.Changeset.change(config_entry, %{value: value})
  23. |> Repo.update()
  24. end
  25. end
  26. end