summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20221103014728_swap_primary_oban_indexes.exs
blob: 54e2503de9e312f1bdbb3b9da0e64ed40dcd867e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
defmodule Pleroma.Repo.Migrations.SwapPrimaryObanIndexes do
  use Ecto.Migration

  @disable_ddl_transaction true
  @disable_migration_lock true

  def change do
    create_if_not_exists(
      index(
        :oban_jobs,
        [:state, :queue, :priority, :scheduled_at, :id],
        concurrently: true,
        prefix: "public"
      )
    )

    drop_if_exists(
      index(
        :oban_jobs,
        [:queue, :state, :priority, :scheduled_at, :id],
        concurrently: true,
        prefix: "public"
      )
    )
  end
end