diff options
author | Alex Gleason <alex@alexgleason.me> | 2021-12-19 12:55:36 -0600 |
---|---|---|
committer | Alex Gleason <alex@alexgleason.me> | 2021-12-19 12:55:36 -0600 |
commit | 3f8fc34593414f6e35925038c38775203333b3f3 (patch) | |
tree | b11c6c15246dbaa8f0cd1d382d6cb762196c2b1b /priv/repo/migrations/20210717000000_add_poll_to_notifications_enum.exs | |
parent | e311c60923432f30fc4ab7bd37d338d60f40e25f (diff) | |
parent | 50892a198d14a628c37139761b709cd5e3261a23 (diff) | |
download | pleroma-3f8fc34593414f6e35925038c38775203333b3f3.tar.gz pleroma-3f8fc34593414f6e35925038c38775203333b3f3.zip |
Merge remote-tracking branch 'origin/develop' into moderators
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.exs | 49 |
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 |