Merge branch 'fix/oban_2_log' into 'develop'

Migration to fix Oban log param in database set to empty string "" instead of false

See merge request pleroma/pleroma!3627
This commit is contained in:
meowski 2024-02-10 10:58:12 +00:00
commit f6107b205f
3 changed files with 33 additions and 1 deletions

7
.gitignore vendored
View file

@ -59,3 +59,10 @@ pleroma.iml
# Editor temp files
/*~
/*#
# if this is pleroma's home (probably shouldn't be)
.bash-history
.psql-history
.cache
.hex
.mix

View file

@ -16,7 +16,6 @@ defmodule Elixir.Pleroma.Repo.Migrations.Oban20ConfigChanges do
if config_entry do
%{value: value} = config_entry
value =
case Keyword.fetch(value, :verbose) do
{:ok, log} -> Keyword.put_new(value, :log, log)

View file

@ -0,0 +1,26 @@
defmodule Elixir.Pleroma.Repo.Migrations.Oban20ChangesRedux 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, :log) do
{:ok, log} -> Keyword.put(value, :log, false)
_ -> value
end
Ecto.Changeset.change(config_entry, %{value: value})
|> Repo.update()
end
end
end