Migrations: Add `accepts_chat_messages` to users.
authorlain <lain@soykaf.club>
Fri, 3 Jul 2020 10:46:28 +0000 (12:46 +0200)
committerlain <lain@soykaf.club>
Fri, 3 Jul 2020 10:46:28 +0000 (12:46 +0200)
priv/repo/migrations/20200703101031_add_chat_acceptance_to_users.exs [new file with mode: 0644]

diff --git a/priv/repo/migrations/20200703101031_add_chat_acceptance_to_users.exs b/priv/repo/migrations/20200703101031_add_chat_acceptance_to_users.exs
new file mode 100644 (file)
index 0000000..4ae3c42
--- /dev/null
@@ -0,0 +1,12 @@
+defmodule Pleroma.Repo.Migrations.AddChatAcceptanceToUsers do
+  use Ecto.Migration
+
+  def change do
+    alter table(:users) do
+      add(:accepts_chat_messages, :boolean, nullable: false, default: false)
+    end
+
+    # Looks stupid but makes the update much faster
+    execute("update users set accepts_chat_messages = local where local = true")
+  end
+end