logo

pleroma

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

20220605185734_add_update_to_notifications_enum.exs (967B)


  1. defmodule Pleroma.Repo.Migrations.AddUpdateToNotificationsEnum do
  2. use Ecto.Migration
  3. @disable_ddl_transaction true
  4. def up do
  5. """
  6. alter type notification_type add value 'update'
  7. """
  8. |> execute()
  9. end
  10. # 20210717000000_add_poll_to_notifications_enum.exs
  11. def down do
  12. alter table(:notifications) do
  13. modify(:type, :string)
  14. end
  15. """
  16. delete from notifications where type = 'update'
  17. """
  18. |> execute()
  19. """
  20. drop type if exists notification_type
  21. """
  22. |> execute()
  23. """
  24. create type notification_type as enum (
  25. 'follow',
  26. 'follow_request',
  27. 'mention',
  28. 'move',
  29. 'pleroma:emoji_reaction',
  30. 'pleroma:chat_mention',
  31. 'reblog',
  32. 'favourite',
  33. 'pleroma:report',
  34. 'poll'
  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