Error when dropping partition migration

Getting this error on a clean install:

** (Ecto.MigrationError) cannot reverse migration command: execute “ALTER INDEX IF EXISTS "public".oban_jobs_meta_index_old RENAME TO oban_jobs_meta_index\n”. You will need to explicitly define up/0 and down/0 in your migration

only have

defmodule App.Repo.Migrations.AddPartitionedObanJobs do
  use Ecto.Migration

  defdelegate change, to: Oban.Pro.Migrations.DynamicPartitioner
end

defmodule App.Repo.Migrations.AddObanPro do
  use Ecto.Migration

  def up, do: Oban.Pro.Migration.up()

  def down, do: Oban.Pro.Migration.down()
end

type or paste code here

Two things to consider:

  1. You don’t need to run the regular Oban.Migration first, the partitioner migration will create the tables it needs.
  2. The Partitioner is only recommended for systems that are processing a very high number of jobs per day.

Still, that may be a migration bug, which version of Pro are you using?

Hi, I’ve just run into this error as well. I am on Oban pro 1.5.0-rc.4.

Edit: Pretty sure based on the error message it’s the “if exists” part that makes it non reversible using change

The migration also exposes up/1 and down/1 functions, which are what change/1 calls based on the direction. Part of the Pro CI runs is rolling back all migrations, but we use up and down directly.

We’ll update the docs to point toward up and down instead of change.

1 Like