projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'fix/users_ap_id_not_null' into 'develop'
[akkoma]
/
priv
/
repo
/
migrations
/
20200323122421_mrf_config_move_from_instance_namespace.exs
diff --git
a/priv/repo/migrations/20200323122421_mrf_config_move_from_instance_namespace.exs
b/priv/repo/migrations/20200323122421_mrf_config_move_from_instance_namespace.exs
index 6f609461365f8973e32201de366d19a076d62a6a..ef36c4eb7db070044b6a3186688271b3c76640db 100644
(file)
--- a/
priv/repo/migrations/20200323122421_mrf_config_move_from_instance_namespace.exs
+++ b/
priv/repo/migrations/20200323122421_mrf_config_move_from_instance_namespace.exs
@@
-5,13
+5,11
@@
defmodule Pleroma.Repo.Migrations.MrfConfigMoveFromInstanceNamespace do
@old_keys [:rewrite_policy, :mrf_transparency, :mrf_transparency_exclusions]
def change do
@old_keys [:rewrite_policy, :mrf_transparency, :mrf_transparency_exclusions]
def change do
- config = ConfigDB.get_by_params(%{group:
":pleroma", key: ":instance"
})
+ config = ConfigDB.get_by_params(%{group:
:pleroma, key: :instance
})
if config do
if config do
- old_instance = ConfigDB.from_binary(config.value)
-
mrf =
mrf =
-
old_instanc
e
+
config.valu
e
|> Keyword.take(@old_keys)
|> Keyword.new(fn
{:rewrite_policy, policies} -> {:policies, policies}
|> Keyword.take(@old_keys)
|> Keyword.new(fn
{:rewrite_policy, policies} -> {:policies, policies}
@@
-21,15
+19,17
@@
defmodule Pleroma.Repo.Migrations.MrfConfigMoveFromInstanceNamespace do
if mrf != [] do
{:ok, _} =
if mrf != [] do
{:ok, _} =
- ConfigDB.create(
- %{group: ":pleroma", key: ":mrf", value: ConfigDB.to_binary(mrf)},
- false
- )
+ %ConfigDB{}
+ |> ConfigDB.changeset(%{group: :pleroma, key: :mrf, value: mrf})
+ |> Pleroma.Repo.insert()
- new_instance = Keyword.drop(
old_instanc
e, @old_keys)
+ new_instance = Keyword.drop(
config.valu
e, @old_keys)
if new_instance != [] do
if new_instance != [] do
- {:ok, _} = ConfigDB.update(config, %{value: ConfigDB.to_binary(new_instance)}, false)
+ {:ok, _} =
+ config
+ |> ConfigDB.changeset(%{value: new_instance})
+ |> Pleroma.Repo.update()
else
{:ok, _} = ConfigDB.delete(config)
end
else
{:ok, _} = ConfigDB.delete(config)
end