Oban: Is there a reason the install guide recomends calling `up` with version 11?

Hello all. Adding oban to a project and wondering why the install guide has the following:

  def up do
    Oban.Migration.up(version: 11)

Is version 11 somehow significant? I find this to be a little confusing so assuming there might be a reason for it, but it’s not explained. Why would my first version be 11?

it should read, run migration til Oban schema version 11, as also mentioned in the doc, in the case you upgrade Oban to a newer version, you have run the migration once again, with a new migration file

I ran it at version 1 and got this warning:

[warning] The `oban_peers` table is undefined and leadership is disabled.
Run migrations up to v11 to restore peer leadership. In the meantime, distributed plugins
(e.g. Cron, Pruner, Stager) will not run on any nodes.

So 11 is significant. Any docs explaining what the versions mean?

hope @sorentwo will answer your question. My first project, 2 years ago using Oban, it uses version 11 by default

Different versions of oban need different migrations executed. The current oban version you’re running requires version 11. Eventually oban might introduce new changes to their db setup, which will go into version 12. At that point you need to update your version 11 setup in your db to version 12 (in a new migration) and for rollback to go back from version 12 to version 11.

That’s why these migrations are versioned: To allow you to write migrations, which update oban step by step over the lifetime of your project using oban.


@LostKobrakai’s answer is exactly correct. It seems like some variant of that should make it into the Oban.Migration docs, or the install guide.

Early on, there were a lot of migrations while we figured things out. For the past few years, the schema has been stable and no more migrations are planned.


That makes sense. Even though it’s an extra step, I found the module docs for migration separating the initial migration from the upgrade to be illuminating.

An explanation as to why the version number differs from the library version number would be helpful. Additionally, I’m curious if I’d ever want to downgrade to version 1 as the install guide suggests I might.