Migrations: Don't copy over mutes unless there actually are some.
authorlain <lain@soykaf.club>
Mon, 4 Nov 2019 17:13:37 +0000 (18:13 +0100)
committerlain <lain@soykaf.club>
Mon, 4 Nov 2019 17:13:37 +0000 (18:13 +0100)
priv/repo/migrations/20190711042024_copy_muted_to_muted_notifications.exs

index a3c5b52deed44a234221bac695d037de2ac0b436..c0d6b3a87b19c651f31bbf0bc979ffa0d45c9d7f 100644 (file)
@@ -3,6 +3,6 @@ defmodule Pleroma.Repo.Migrations.CopyMutedToMutedNotifications do
   alias Pleroma.User
 
   def change do
-  execute("update users set info = safe_jsonb_set(info, '{muted_notifications}', info->'mutes', true) where local = true")
+  execute("update users set info = safe_jsonb_set(info, '{muted_notifications}', info->'mutes', true) where local = true and info->'mutes' is not null")
   end
 end