From 4b7498c67e4aeb82808892cb82cc00bffb4f47f6 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 21 Mar 2022 16:53:10 +0100 Subject: [PATCH] Migrations after Oban 2.11 Signed-off-by: Thomas Citharel --- .../20220321154138_create_oban_peers.exs | 7 ++++++ ...220321154142_swap_primary_oban_indexes.exs | 25 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 priv/repo/migrations/20220321154138_create_oban_peers.exs create mode 100644 priv/repo/migrations/20220321154142_swap_primary_oban_indexes.exs diff --git a/priv/repo/migrations/20220321154138_create_oban_peers.exs b/priv/repo/migrations/20220321154138_create_oban_peers.exs new file mode 100644 index 000000000..b3f799ad0 --- /dev/null +++ b/priv/repo/migrations/20220321154138_create_oban_peers.exs @@ -0,0 +1,7 @@ +defmodule Mobilizon.Storage.Repo.Migrations.CreateObanPeers do + use Ecto.Migration + + def up, do: Oban.Migrations.up(version: 11) + + def down, do: Oban.Migrations.down(version: 11) +end diff --git a/priv/repo/migrations/20220321154142_swap_primary_oban_indexes.exs b/priv/repo/migrations/20220321154142_swap_primary_oban_indexes.exs new file mode 100644 index 000000000..0fae1ea3b --- /dev/null +++ b/priv/repo/migrations/20220321154142_swap_primary_oban_indexes.exs @@ -0,0 +1,25 @@ +defmodule Mobilizon.Storage.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], + prefix: "public" + ) + ) + end +end