summaryrefslogtreecommitdiff
path: root/priv
diff options
context:
space:
mode:
authorRoman Chvanikov <chvanikoff@pm.me>2019-07-14 21:43:30 +0300
committerRoman Chvanikov <chvanikoff@pm.me>2019-07-14 21:43:30 +0300
commitc729883936c7d258cb670929af9577aec3e22851 (patch)
tree17aec90897b221c000be1992001967a3861a6c10 /priv
parent0384459ce552c50edb582413808a099086b6495e (diff)
parent93701c3399add8af2d4a5d43b6f171d84655a533 (diff)
downloadpleroma-c729883936c7d258cb670929af9577aec3e22851.tar.gz
pleroma-c729883936c7d258cb670929af9577aec3e22851.zip
Merge branch 'develop' into feature/digest-email
Diffstat (limited to 'priv')
-rw-r--r--priv/repo/migrations/20190711042024_copy_muted_to_muted_notifications.exs24
1 files changed, 24 insertions, 0 deletions
diff --git a/priv/repo/migrations/20190711042024_copy_muted_to_muted_notifications.exs b/priv/repo/migrations/20190711042024_copy_muted_to_muted_notifications.exs
new file mode 100644
index 000000000..50669902e
--- /dev/null
+++ b/priv/repo/migrations/20190711042024_copy_muted_to_muted_notifications.exs
@@ -0,0 +1,24 @@
+defmodule Pleroma.Repo.Migrations.CopyMutedToMutedNotifications do
+ use Ecto.Migration
+ alias Pleroma.User
+
+ def change do
+ query =
+ User.Query.build(%{
+ local: true,
+ active: true,
+ order_by: :id
+ })
+
+ Pleroma.Repo.stream(query)
+ |> Enum.each(fn
+ %{info: %{mutes: mutes} = info} = user ->
+ info_cng =
+ Ecto.Changeset.cast(info, %{muted_notifications: mutes}, [:muted_notifications])
+
+ Ecto.Changeset.change(user)
+ |> Ecto.Changeset.put_embed(:info, info_cng)
+ |> Pleroma.Repo.update()
+ end)
+ end
+end