logo

pleroma

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

20200606105430_change_type_to_enum_for_notifications.exs (824B)


  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.ChangeTypeToEnumForNotifications do
  5. use Ecto.Migration
  6. def up do
  7. """
  8. create type notification_type as enum (
  9. 'follow',
  10. 'follow_request',
  11. 'mention',
  12. 'move',
  13. 'pleroma:emoji_reaction',
  14. 'pleroma:chat_mention',
  15. 'reblog',
  16. 'favourite'
  17. )
  18. """
  19. |> execute()
  20. """
  21. alter table notifications
  22. alter column type type notification_type using (type::notification_type)
  23. """
  24. |> execute()
  25. end
  26. def down do
  27. alter table(:notifications) do
  28. modify(:type, :string)
  29. end
  30. """
  31. drop type notification_type
  32. """
  33. |> execute()
  34. end
  35. end