First
[anni] / priv / repo / migrations / 20200708193702_drop_user_trigram_index.exs
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
5 defmodule Pleroma.Repo.Migrations.DropUserTrigramIndex do
6   @moduledoc "Drops unused trigram index on `users` (FTS index is being used instead)"
7
8   use Ecto.Migration
9
10   def up do
11     drop_if_exists(index(:users, [], name: :users_trigram_index))
12   end
13
14   def down do
15     create_if_not_exists(
16       index(:users, ["(trim(nickname || ' ' || coalesce(name, ''))) gist_trgm_ops"],
17         name: :users_trigram_index,
18         using: :gist
19       )
20     )
21   end
22 end