diff options
author | Alex Gleason <alex@alexgleason.me> | 2020-07-22 14:18:09 -0500 |
---|---|---|
committer | Alex Gleason <alex@alexgleason.me> | 2020-07-22 14:32:45 -0500 |
commit | c7a0016f9f4731c58a7989c7ee10e19d3f90d2eb (patch) | |
tree | c04ac473e6d76088ef9caf029b7e355cecec0dbb /priv | |
parent | b87a1f8eaff7e5663fd4b84b43be350754eb37d2 (diff) | |
download | pleroma-c7a0016f9f4731c58a7989c7ee10e19d3f90d2eb.tar.gz |
Migration to fix malformed Pleroma.Formatter config
Diffstat (limited to 'priv')
-rw-r--r-- | priv/repo/migrations/20200722185515_fix_malformed_formatter_config.exs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/priv/repo/migrations/20200722185515_fix_malformed_formatter_config.exs b/priv/repo/migrations/20200722185515_fix_malformed_formatter_config.exs new file mode 100644 index 000000000..77b760825 --- /dev/null +++ b/priv/repo/migrations/20200722185515_fix_malformed_formatter_config.exs @@ -0,0 +1,26 @@ +defmodule Pleroma.Repo.Migrations.FixMalformedFormatterConfig do + use Ecto.Migration + alias Pleroma.ConfigDB + + @config_path %{group: :pleroma, key: Pleroma.Formatter} + + def change do + with %ConfigDB{value: %{} = opts} <- ConfigDB.get_by_params(@config_path), + fixed_opts <- Map.to_list(opts) do + fix_config(fixed_opts) + else + _ -> :skipped + end + end + + defp fix_config(fixed_opts) when is_list(fixed_opts) do + {:ok, _} = + ConfigDB.update_or_create(%{ + group: :pleroma, + key: Pleroma.Formatter, + value: fixed_opts + }) + + :ok + end +end |