Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
602B

  1. defmodule Pleroma.Repo.Migrations.FixMalformedFormatterConfig do
  2. use Ecto.Migration
  3. alias Pleroma.ConfigDB
  4. @config_path %{group: :pleroma, key: Pleroma.Formatter}
  5. def change do
  6. with %ConfigDB{value: %{} = opts} <- ConfigDB.get_by_params(@config_path),
  7. fixed_opts <- Map.to_list(opts) do
  8. fix_config(fixed_opts)
  9. else
  10. _ -> :skipped
  11. end
  12. end
  13. defp fix_config(fixed_opts) when is_list(fixed_opts) do
  14. {:ok, _} =
  15. ConfigDB.update_or_create(%{
  16. group: :pleroma,
  17. key: Pleroma.Formatter,
  18. value: fixed_opts
  19. })
  20. :ok
  21. end
  22. end