Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
695B

  1. defmodule Pleroma.Repo.Migrations.ChangeFollowingRelationshipsStateToInteger do
  2. use Ecto.Migration
  3. @alter_following_relationship_state "ALTER TABLE following_relationships ALTER COLUMN state"
  4. def up do
  5. execute("""
  6. #{@alter_following_relationship_state} TYPE integer USING
  7. CASE
  8. WHEN state = 'pending' THEN 1
  9. WHEN state = 'accept' THEN 2
  10. WHEN state = 'reject' THEN 3
  11. ELSE 0
  12. END;
  13. """)
  14. end
  15. def down do
  16. execute("""
  17. #{@alter_following_relationship_state} TYPE varchar(255) USING
  18. CASE
  19. WHEN state = 1 THEN 'pending'
  20. WHEN state = 2 THEN 'accept'
  21. WHEN state = 3 THEN 'reject'
  22. ELSE ''
  23. END;
  24. """)
  25. end
  26. end