logo

pleroma

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

20220711192750_switch_to_associated_object_id_index.exs (983B)


  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.SwitchToAssociatedObjectIdIndex do
  5. use Ecto.Migration
  6. @disable_ddl_transaction true
  7. @disable_migration_lock true
  8. def up do
  9. drop_if_exists(
  10. index(:activities, ["(coalesce(data->'object'->>'id', data->>'object'))"],
  11. name: :activities_create_objects_index
  12. )
  13. )
  14. create(
  15. index(:activities, ["associated_object_id(data)"],
  16. name: :activities_create_objects_index,
  17. concurrently: true
  18. )
  19. )
  20. end
  21. def down do
  22. drop_if_exists(
  23. index(:activities, ["associated_object_id(data)"], name: :activities_create_objects_index)
  24. )
  25. create(
  26. index(:activities, ["(coalesce(data->'object'->>'id', data->>'object'))"],
  27. name: :activities_create_objects_index,
  28. concurrently: true
  29. )
  30. )
  31. end
  32. end