summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20210717000000_add_poll_to_notifications_enum.exs
diff options
context:
space:
mode:
authorAlex Gleason <alex@alexgleason.me>2021-11-24 17:58:58 -0600
committerAlex Gleason <alex@alexgleason.me>2021-11-24 17:58:58 -0600
commit720198d56950ca98f4d947dd630b0e170eda569b (patch)
treecd20e64e7daaa8ba033ba6510e137de2d2ccb24e /priv/repo/migrations/20210717000000_add_poll_to_notifications_enum.exs
parentcb9359335f6b0e1d19fb82e4045740d30767254c (diff)
parentc97f99ccf2a51c7f1078d7a20006deae2df3d12c (diff)
downloadpleroma-720198d56950ca98f4d947dd630b0e170eda569b.tar.gz
pleroma-720198d56950ca98f4d947dd630b0e170eda569b.zip
Merge remote-tracking branch 'pleroma/develop' into manifest
Diffstat (limited to 'priv/repo/migrations/20210717000000_add_poll_to_notifications_enum.exs')
-rw-r--r--priv/repo/migrations/20210717000000_add_poll_to_notifications_enum.exs49
1 files changed, 49 insertions, 0 deletions
diff --git a/priv/repo/migrations/20210717000000_add_poll_to_notifications_enum.exs b/priv/repo/migrations/20210717000000_add_poll_to_notifications_enum.exs
new file mode 100644
index 000000000..9abf40b3d
--- /dev/null
+++ b/priv/repo/migrations/20210717000000_add_poll_to_notifications_enum.exs
@@ -0,0 +1,49 @@
+defmodule Pleroma.Repo.Migrations.AddPollToNotificationsEnum do
+ use Ecto.Migration
+
+ @disable_ddl_transaction true
+
+ def up do
+ """
+ alter type notification_type add value 'poll'
+ """
+ |> execute()
+ end
+
+ def down do
+ alter table(:notifications) do
+ modify(:type, :string)
+ end
+
+ """
+ delete from notifications where type = 'poll'
+ """
+ |> execute()
+
+ """
+ drop type if exists notification_type
+ """
+ |> execute()
+
+ """
+ create type notification_type as enum (
+ 'follow',
+ 'follow_request',
+ 'mention',
+ 'move',
+ 'pleroma:emoji_reaction',
+ 'pleroma:chat_mention',
+ 'reblog',
+ 'favourite',
+ 'pleroma:report'
+ )
+ """
+ |> execute()
+
+ """
+ alter table notifications
+ alter column type type notification_type using (type::notification_type)
+ """
+ |> execute()
+ end
+end