summaryrefslogtreecommitdiff
path: root/priv/repo/migrations
diff options
context:
space:
mode:
authorfeld <feld@feld.me>2020-07-15 15:22:39 +0000
committerfeld <feld@feld.me>2020-07-15 15:22:39 +0000
commit00f9b53f07346d052adab105bde3428c98fc4660 (patch)
tree67e501144cffd4c3e70f8dc094793c6b2d2fb7b5 /priv/repo/migrations
parent0fe36b311c010f9a4bd3c1600ce874c5403a7368 (diff)
parent34d1d3e93e8642f2b784b5b957551af068c0f7ba (diff)
downloadpleroma-00f9b53f07346d052adab105bde3428c98fc4660.tar.gz
pleroma-00f9b53f07346d052adab105bde3428c98fc4660.zip
Merge branch 'refactor/notification_settings' into 'develop'
Refactor notification settings See merge request pleroma/pleroma!2602
Diffstat (limited to 'priv/repo/migrations')
-rw-r--r--priv/repo/migrations/20200626163359_rename_notification_privacy_option.exs19
1 files changed, 19 insertions, 0 deletions
diff --git a/priv/repo/migrations/20200626163359_rename_notification_privacy_option.exs b/priv/repo/migrations/20200626163359_rename_notification_privacy_option.exs
new file mode 100644
index 000000000..06d7f7272
--- /dev/null
+++ b/priv/repo/migrations/20200626163359_rename_notification_privacy_option.exs
@@ -0,0 +1,19 @@
+defmodule Pleroma.Repo.Migrations.RenameNotificationPrivacyOption do
+ use Ecto.Migration
+
+ def up do
+ execute(
+ "UPDATE users SET notification_settings = notification_settings - 'privacy_option' || jsonb_build_object('hide_notification_contents', notification_settings->'privacy_option')
+where notification_settings ? 'privacy_option'
+and local"
+ )
+ end
+
+ def down do
+ execute(
+ "UPDATE users SET notification_settings = notification_settings - 'hide_notification_contents' || jsonb_build_object('privacy_option', notification_settings->'hide_notification_contents')
+where notification_settings ? 'hide_notification_contents'
+and local"
+ )
+ end
+end