Migrations: Change object index on activities

This will now only index create activities.
This commit is contained in:
lain 2020-11-15 12:49:49 +01:00
parent 157e32a39c
commit 6b9fa21dc8

View File

@ -0,0 +1,22 @@
defmodule Pleroma.Repo.Migrations.ChangeObjectIndexOnCreateActivities do
use Ecto.Migration
@disable_ddl_transaction true
@disable_migration_lock true
def change do
drop_if_exists(
index(:activities, ["(coalesce(data->'object'->>'id', data->>'object'))"],
name: :activities_create_objects_index
)
)
create(
index(:activities, ["(coalesce(data->'object'->>'id', data->>'object'))"],
name: :activities_create_objects_index,
concurrently: true,
where: "data->>'type' = 'Create'"
)
)
end
end