logo

pleroma

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

20210717000000_add_poll_to_notifications_enum.exs (1052B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Repo.Migrations.AddPollToNotificationsEnum do
  5. use Ecto.Migration
  6. @disable_ddl_transaction true
  7. def up do
  8. """
  9. alter type notification_type add value 'poll'
  10. """
  11. |> execute()
  12. end
  13. def down do
  14. alter table(:notifications) do
  15. modify(:type, :string)
  16. end
  17. """
  18. delete from notifications where type = 'poll'
  19. """
  20. |> execute()
  21. """
  22. drop type if exists notification_type
  23. """
  24. |> execute()
  25. """
  26. create type notification_type as enum (
  27. 'follow',
  28. 'follow_request',
  29. 'mention',
  30. 'move',
  31. 'pleroma:emoji_reaction',
  32. 'pleroma:chat_mention',
  33. 'reblog',
  34. 'favourite',
  35. 'pleroma:report'
  36. )
  37. """
  38. |> execute()
  39. """
  40. alter table notifications
  41. alter column type type notification_type using (type::notification_type)
  42. """
  43. |> execute()
  44. end
  45. end