Notification: Change type of type to an enum.

This commit is contained in:
lain 2020-06-06 13:08:45 +02:00
commit 9fa3f0b156
2 changed files with 39 additions and 0 deletions

View file

@ -0,0 +1,36 @@
defmodule Pleroma.Repo.Migrations.ChangeTypeToEnumForNotifications do
use Ecto.Migration
def up do
"""
create type notification_type as enum (
'follow',
'follow_request',
'mention',
'move',
'pleroma:emoji_reaction',
'pleroma:chat_mention',
'reblog',
'favourite'
)
"""
|> execute()
"""
alter table notifications
alter column type type notification_type using (type::notification_type)
"""
|> execute()
end
def down do
alter table(:notifications) do
modify(:type, :string)
end
"""
drop type notification_type
"""
|> execute()
end
end