defmodule Pleroma.Repo.Migrations.AddPublishedIndexToActivities do use Ecto.Migration def change do create_if_not_exists( index(:activities, ["case when data->>'type' = 'Create' then (data->'object'->>'published')::timestamptz else inserted_at end"], name: :activities_published, concurrently: true ) ) end end