summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20210717000000_add_poll_to_notifications_enum.exs
diff options
context:
space:
mode:
authorAlex Gleason <alex@alexgleason.me>2021-12-25 19:57:53 -0600
committerAlex Gleason <alex@alexgleason.me>2021-12-25 19:57:53 -0600
commitdb2bf55e9bb31af2ed34805ca7fa98ce67b471b1 (patch)
treef532711eaf19111e22375e87706edf5a3024e5b5 /priv/repo/migrations/20210717000000_add_poll_to_notifications_enum.exs
parentb15c4629ff3093353ac5e37d381db1cdc4da1c3a (diff)
parent73609211a425922a5068d3912a36b82abe24e12c (diff)
downloadpleroma-db2bf55e9bb31af2ed34805ca7fa98ce67b471b1.tar.gz
pleroma-db2bf55e9bb31af2ed34805ca7fa98ce67b471b1.zip
Merge remote-tracking branch 'origin/develop' into notice-routes
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