move to 2.5.5
[anni] / priv / repo / migrations / 20171023155035_add_second_object_index_to_activty.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.AddSecondObjectIndexToActivty do
6   use Ecto.Migration
7
8   @disable_ddl_transaction true
9
10   def change do
11     drop_if_exists(
12       index(:activities, ["(data->'object'->>'id')", "(data->>'type')"],
13         name: :activities_create_objects_index
14       )
15     )
16
17     create(
18       index(:activities, ["(coalesce(data->'object'->>'id', data->>'object'))"],
19         name: :activities_create_objects_index,
20         concurrently: true
21       )
22     )
23   end
24 end