54e2503de9e312f1bdbb3b9da0e64ed40dcd867e
[anni] / priv / repo / migrations / 20221103014728_swap_primary_oban_indexes.exs
1 defmodule Pleroma.Repo.Migrations.SwapPrimaryObanIndexes do
2   use Ecto.Migration
3
4   @disable_ddl_transaction true
5   @disable_migration_lock true
6
7   def change do
8     create_if_not_exists(
9       index(
10         :oban_jobs,
11         [:state, :queue, :priority, :scheduled_at, :id],
12         concurrently: true,
13         prefix: "public"
14       )
15     )
16
17     drop_if_exists(
18       index(
19         :oban_jobs,
20         [:queue, :state, :priority, :scheduled_at, :id],
21         concurrently: true,
22         prefix: "public"
23       )
24     )
25   end
26 end