2022-02-26 06:11:42 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
2023-01-01 11:11:47 +00:00
|
|
|
# Copyright © 2017-2023 Pleroma Authors <https://pleroma.social/>
|
2022-02-26 06:11:42 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-07-14 09:00:53 +00:00
|
|
|
defmodule Elixir.Pleroma.Repo.Migrations.Oban20ConfigChanges do
|
|
|
|
use Ecto.Migration
|
|
|
|
import Ecto.Query
|
|
|
|
alias Pleroma.ConfigDB
|
|
|
|
alias Pleroma.Repo
|
|
|
|
|
|
|
|
def change do
|
|
|
|
config_entry =
|
|
|
|
from(c in ConfigDB, where: c.group == ^":pleroma" and c.key == ^"Oban")
|
|
|
|
|> select([c], struct(c, [:value, :id]))
|
|
|
|
|> Repo.one()
|
|
|
|
|
|
|
|
if config_entry do
|
|
|
|
%{value: value} = config_entry
|
|
|
|
|
|
|
|
value =
|
|
|
|
case Keyword.fetch(value, :verbose) do
|
|
|
|
{:ok, log} -> Keyword.put_new(value, :log, log)
|
|
|
|
_ -> value
|
|
|
|
end
|
|
|
|
|> Keyword.drop([:verbose, :prune])
|
|
|
|
|
|
|
|
Ecto.Changeset.change(config_entry, %{value: value})
|
|
|
|
|> Repo.update()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|