Migration failed when no value for Pleroma.Upload was set

This commit is contained in:
Ilja 2022-02-21 09:38:38 +01:00
parent cc5686bbd6
commit 75ea766824

View file

@ -20,15 +20,18 @@ defmodule Pleroma.Repo.Migrations.UploadFilterExiftoolToExiftoolStripLocation do
) )
defp update_filtername(%{value: value}, from_filtername, to_filtername) do defp update_filtername(%{value: value}, from_filtername, to_filtername) do
new_filters = new_value =
value[:filters] value
|> Keyword.update(:filters, [], fn filters ->
filters
|> Enum.map(fn |> Enum.map(fn
^from_filtername -> to_filtername ^from_filtername -> to_filtername
filter -> filter filter -> filter
end) end)
end)
new_value = value |> Keyword.update(:filters, [], fn _ -> new_filters end)
ConfigDB.update_or_create(%{group: :pleroma, key: Pleroma.Upload, value: new_value}) ConfigDB.update_or_create(%{group: :pleroma, key: Pleroma.Upload, value: new_value})
end end
defp update_filtername(_, _, _), do: nil
end end