diff options
author | Alex Gleason <alex@alexgleason.me> | 2021-12-15 19:05:36 -0500 |
---|---|---|
committer | Alex Gleason <alex@alexgleason.me> | 2021-12-15 19:05:36 -0500 |
commit | e1b89fe3aa2c03576a6f2418c1e83c0ed64707a3 (patch) | |
tree | 6a8b31ef3612c4f8f5b405361c7cb875f4661d84 /priv/repo/migrations/20210717000000_add_poll_to_notifications_enum.exs | |
parent | 29d80b39f287ed2488a612280d41e9dd2e40a7cc (diff) | |
parent | 6eb7d69e60a96e577de92de232ed48e509f23cd4 (diff) | |
download | pleroma-e1b89fe3aa2c03576a6f2418c1e83c0ed64707a3.tar.gz pleroma-e1b89fe3aa2c03576a6f2418c1e83c0ed64707a3.zip |
Merge remote-tracking branch 'origin/develop' into live-dashboard
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 |