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.

27 lines
455B

  1. defmodule Pleroma.Repo.Migrations.AddApIdToLists do
  2. use Ecto.Migration
  3. def up do
  4. alter table(:lists) do
  5. add(:ap_id, :string)
  6. end
  7. execute("""
  8. UPDATE lists
  9. SET ap_id = u.ap_id || '/lists/' || lists.id
  10. FROM users AS u
  11. WHERE lists.user_id = u.id
  12. """)
  13. create(unique_index(:lists, :ap_id))
  14. end
  15. def down do
  16. drop(index(:lists, [:ap_id]))
  17. alter table(:lists) do
  18. remove(:ap_id)
  19. end
  20. end
  21. end