diff options
author | Alex Gleason <alex@alexgleason.me> | 2021-11-24 17:58:58 -0600 |
---|---|---|
committer | Alex Gleason <alex@alexgleason.me> | 2021-11-24 17:58:58 -0600 |
commit | 720198d56950ca98f4d947dd630b0e170eda569b (patch) | |
tree | cd20e64e7daaa8ba033ba6510e137de2d2ccb24e /priv/repo/migrations/20210717000000_add_poll_to_notifications_enum.exs | |
parent | cb9359335f6b0e1d19fb82e4045740d30767254c (diff) | |
parent | c97f99ccf2a51c7f1078d7a20006deae2df3d12c (diff) | |
download | pleroma-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.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 |