diff options
author | lain <lain@soykaf.club> | 2020-11-15 12:49:49 +0100 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-11-15 12:49:49 +0100 |
commit | 6b9fa21dc8b0d020753ac1e675bbaff818c29086 (patch) | |
tree | 002d36b96127901b69649c0937a390b5ea760183 | |
parent | 157e32a39c2da6b907cc86a1c3295cbbec5ffc10 (diff) | |
download | pleroma-6b9fa21dc8b0d020753ac1e675bbaff818c29086.tar.gz |
Migrations: Change object index on activities
This will now only index create activities.
-rw-r--r-- | priv/repo/migrations/20201115114437_change_object_index_on_create_activities.exs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/priv/repo/migrations/20201115114437_change_object_index_on_create_activities.exs b/priv/repo/migrations/20201115114437_change_object_index_on_create_activities.exs new file mode 100644 index 000000000..e2137063f --- /dev/null +++ b/priv/repo/migrations/20201115114437_change_object_index_on_create_activities.exs @@ -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 |