logo

pleroma

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

20190204200237_add_correct_dm_index.exs (935B)


  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.AddCorrectDMIndex do
  5. use Ecto.Migration
  6. @disable_ddl_transaction true
  7. def up do
  8. drop_if_exists(
  9. index(:activities, ["activity_visibility(actor, recipients, data)"],
  10. name: :activities_visibility_index
  11. )
  12. )
  13. create(
  14. index(:activities, ["activity_visibility(actor, recipients, data)", "id DESC NULLS LAST"],
  15. name: :activities_visibility_index,
  16. concurrently: true,
  17. where: "data->>'type' = 'Create'"
  18. )
  19. )
  20. end
  21. def down do
  22. drop_if_exists(
  23. index(:activities, ["activity_visibility(actor, recipients, data)", "id DESC"],
  24. name: :activities_visibility_index,
  25. concurrently: true,
  26. where: "data->>'type' = 'Create'"
  27. )
  28. )
  29. end
  30. end