logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

20220319000000_add_status_to_notifications_enum.exs (929B)


  1. defmodule Pleroma.Repo.Migrations.AddStatusToNotificationsEnum do
  2. use Ecto.Migration
  3. @disable_ddl_transaction true
  4. def up do
  5. """
  6. alter type notification_type add value 'status'
  7. """
  8. |> execute()
  9. end
  10. def down do
  11. alter table(:notifications) do
  12. modify(:type, :string)
  13. end
  14. """
  15. delete from notifications where type = 'status'
  16. """
  17. |> execute()
  18. """
  19. drop type if exists notification_type
  20. """
  21. |> execute()
  22. """
  23. create type notification_type as enum (
  24. 'follow',
  25. 'follow_request',
  26. 'mention',
  27. 'move',
  28. 'pleroma:emoji_reaction',
  29. 'pleroma:chat_mention',
  30. 'reblog',
  31. 'favourite',
  32. 'pleroma:report',
  33. 'poll',
  34. 'update'
  35. )
  36. """
  37. |> execute()
  38. """
  39. alter table notifications
  40. alter column type type notification_type using (type::notification_type)
  41. """
  42. |> execute()
  43. end
  44. end