diff options
author | lain <lain@soykaf.club> | 2019-11-04 15:38:28 +0100 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-11-04 15:38:28 +0100 |
commit | 5f844fd3f2b35075bd3a90c71315c321fec6a6e8 (patch) | |
tree | 52c01386ac093eab63993e07ebab46b2b5dcdea4 | |
parent | 4bab9672ed3d2dd4c1c62b2e233e79b671526515 (diff) | |
download | pleroma-5f844fd3f2b35075bd3a90c71315c321fec6a6e8.tar.gz |
Migrations: Add a fixup migration for the muted_notifications
This sets info->muted_notifications to an emtpy array if it is explicitly set
to null before. This can happen when safe_jsonb_set coalesces to a jsonb null,
which will make ecto not use the default value of [] anymore because it has been
explicitly overwritten.
-rw-r--r-- | priv/repo/migrations/20191104143558_fix_null_muted_notification_fields.exs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/priv/repo/migrations/20191104143558_fix_null_muted_notification_fields.exs b/priv/repo/migrations/20191104143558_fix_null_muted_notification_fields.exs new file mode 100644 index 000000000..e17e75983 --- /dev/null +++ b/priv/repo/migrations/20191104143558_fix_null_muted_notification_fields.exs @@ -0,0 +1,7 @@ +defmodule Pleroma.Repo.Migrations.FixNullMutedNotificationFields do + use Ecto.Migration + + def change do + execute("update users set info = safe_jsonb_set(info, '{muted_notifications}', '[]'::jsonb, true) where local = true and info->'muted_notifications' = 'null'::jsonb") + end +end |