logo

pleroma

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

20190118074940_fix_user_trigram_index.exs (752B)


  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.FixUserTrigramIndex do
  5. use Ecto.Migration
  6. def up do
  7. drop_if_exists(index(:users, [], name: :users_trigram_index))
  8. create_if_not_exists(
  9. index(:users, ["(trim(nickname || ' ' || coalesce(name, ''))) gist_trgm_ops"],
  10. name: :users_trigram_index,
  11. using: :gist
  12. )
  13. )
  14. end
  15. def down do
  16. drop_if_exists(index(:users, [], name: :users_trigram_index))
  17. create_if_not_exists(
  18. index(:users, ["(nickname || name) gist_trgm_ops"],
  19. name: :users_trigram_index,
  20. using: :gist
  21. )
  22. )
  23. end
  24. end