logo

pleroma

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

20200831152600_add_pleroma_report_to_enum_for_notifications.exs (1065B)


  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.AddPleromaReportTypeToEnumForNotifications do
  5. use Ecto.Migration
  6. @disable_ddl_transaction true
  7. def up do
  8. """
  9. alter type notification_type add value 'pleroma:report'
  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 = 'pleroma:report'
  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. )
  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