logo

pleroma

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

20230422154018_drop_unused_indexes.exs (1841B)


  1. defmodule Pleroma.Repo.Migrations.DropUnusedIndexes do
  2. use Ecto.Migration
  3. @disable_ddl_transaction true
  4. @disable_migration_lock true
  5. def up do
  6. drop_if_exists(
  7. index(:activities, ["(data->>'actor')", "inserted_at desc"], name: :activities_actor_index)
  8. )
  9. drop_if_exists(index(:activities, ["(data->'to')"], name: :activities_to_index))
  10. drop_if_exists(index(:activities, ["(data->'cc')"], name: :activities_cc_index))
  11. drop_if_exists(index(:activities, ["(split_part(actor, '/', 3))"], name: :activities_hosts))
  12. drop_if_exists(
  13. index(:activities, ["(data->'object'->>'inReplyTo')"], name: :activities_in_reply_to)
  14. )
  15. drop_if_exists(
  16. index(:activities, ["((data #> '{\"object\",\"likes\"}'))"], name: :activities_likes)
  17. )
  18. end
  19. def down do
  20. create_if_not_exists(
  21. index(:activities, ["(data->>'actor')", "inserted_at desc"],
  22. name: :activities_actor_index,
  23. concurrently: true
  24. )
  25. )
  26. create_if_not_exists(
  27. index(:activities, ["(data->'to')"],
  28. name: :activities_to_index,
  29. using: :gin,
  30. concurrently: true
  31. )
  32. )
  33. create_if_not_exists(
  34. index(:activities, ["(data->'cc')"],
  35. name: :activities_cc_index,
  36. using: :gin,
  37. concurrently: true
  38. )
  39. )
  40. create_if_not_exists(
  41. index(:activities, ["(split_part(actor, '/', 3))"],
  42. name: :activities_hosts,
  43. concurrently: true
  44. )
  45. )
  46. create_if_not_exists(
  47. index(:activities, ["(data->'object'->>'inReplyTo')"],
  48. name: :activities_in_reply_to,
  49. concurrently: true
  50. )
  51. )
  52. create_if_not_exists(
  53. index(:activities, ["((data #> '{\"object\",\"likes\"}'))"],
  54. name: :activities_likes,
  55. using: :gin,
  56. concurrently: true
  57. )
  58. )
  59. end
  60. end