First
[anni] / priv / repo / migrations / 20190501125843_add_fts_index_to_objects.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.AddFTSIndexToObjects do
6   use Ecto.Migration
7
8   def change do
9     drop_if_exists(
10       index(:activities, ["(to_tsvector('english', data->'object'->>'content'))"],
11         using: :gin,
12         name: :activities_fts
13       )
14     )
15
16     create_if_not_exists(
17       index(:objects, ["(to_tsvector('english', data->>'content'))"],
18         using: :gin,
19         name: :objects_fts
20       )
21     )
22   end
23 end