Merge remote-tracking branch 'pleroma/develop' into dont-crash-email-settings
[akkoma] / priv / repo / migrations / 20210401143153_user_notification_settings_fix.exs
1 defmodule Pleroma.Repo.Migrations.UserNotificationSettingsFix do
2 use Ecto.Migration
3
4 def up do
5 execute(~s(UPDATE users
6 SET
7 notification_settings = '{"followers": true, "follows": true, "non_follows": true, "non_followers": true}'::jsonb WHERE notification_settings IS NULL
8 ))
9
10 execute("ALTER TABLE users
11 ALTER COLUMN notification_settings SET NOT NULL")
12 end
13
14 def down do
15 :ok
16 end
17 end