logo

pleroma

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

20200910113106_remove_managed_config_from_db.exs (713B)


  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 Pleroma.Repo.Migrations.RemoveManagedConfigFromDb do
  5. use Ecto.Migration
  6. import Ecto.Query
  7. alias Pleroma.ConfigDB
  8. alias Pleroma.Repo
  9. def up do
  10. config_entry =
  11. from(c in ConfigDB,
  12. select: [:id, :value],
  13. where: c.group == ^:pleroma and c.key == ^:instance
  14. )
  15. |> Repo.one()
  16. if config_entry do
  17. {_, value} = Keyword.pop(config_entry.value, :managed_config)
  18. config_entry
  19. |> Ecto.Changeset.change(value: value)
  20. |> Repo.update()
  21. end
  22. end
  23. def down do
  24. :ok
  25. end
  26. end