Merge branch 'develop' of https://git.pleroma.social/pleroma/pleroma into develop
[akkoma] / priv / repo / migrations / 20200606105430_change_type_to_enum_for_notifications.exs
1 defmodule Pleroma.Repo.Migrations.ChangeTypeToEnumForNotifications do
2 use Ecto.Migration
3
4 def up do
5 """
6 create type notification_type as enum (
7 'follow',
8 'follow_request',
9 'mention',
10 'move',
11 'pleroma:emoji_reaction',
12 'pleroma:chat_mention',
13 'reblog',
14 'favourite'
15 )
16 """
17 |> execute()
18
19 """
20 alter table notifications
21 alter column type type notification_type using (type::notification_type)
22 """
23 |> execute()
24 end
25
26 def down do
27 alter table(:notifications) do
28 modify(:type, :string)
29 end
30
31 """
32 drop type notification_type
33 """
34 |> execute()
35 end
36 end