logo

pleroma

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

20190516112144_add_ap_id_to_lists.exs (614B)


  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.AddApIdToLists do
  5. use Ecto.Migration
  6. def up do
  7. alter table(:lists) do
  8. add(:ap_id, :string)
  9. end
  10. execute("""
  11. UPDATE lists
  12. SET ap_id = u.ap_id || '/lists/' || lists.id
  13. FROM users AS u
  14. WHERE lists.user_id = u.id
  15. """)
  16. create(unique_index(:lists, :ap_id))
  17. end
  18. def down do
  19. drop(index(:lists, [:ap_id]))
  20. alter table(:lists) do
  21. remove(:ap_id)
  22. end
  23. end
  24. end