Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JobDispatcher error with custom jobs_table_name #54

Closed
onomated opened this issue Feb 22, 2019 · 3 comments
Closed

JobDispatcher error with custom jobs_table_name #54

onomated opened this issue Feb 22, 2019 · 3 comments
Labels
bug Something isn't working

Comments

@onomated
Copy link
Contributor

This error is returned when attempting to dispatch jobs with a custom jobs_table_name config:

[error] GenServer Rihanna.JobDispatcher terminating
** (ArgumentError) The Rihanna jobs table must be upgraded.

The easiest way to upgrade the database is with Ecto.

Run `mix ecto.gen.migration upgrade_rihanna_jobs` and make your migration look
like this:

    defmodule MyApp.UpgradeRihannaJobs do
      use Rihanna.Migration.Upgrade
    end

Now you can run `mix ecto.migrate`.

    (rihanna) lib/rihanna/migration.ex:267: Rihanna.Migration.raise_upgrade_required!/0
    (rihanna) lib/rihanna/job_dispatcher.ex:31: Rihanna.JobDispatcher.handle_info/2

The check here: https://github.com/samphilipd/rihanna/blob/master/lib/rihanna/migration.ex#L234
is looking for the wrong primary key index. For example, with:

config :rihanna, jobs_table_name: "background_jobs",

The generated primary key index name is background_jobs_pkey vs.rihanna_jobs_pkey resulting in the error above.

@lpil lpil added the bug Something isn't working label Feb 22, 2019
@lpil
Copy link
Collaborator

lpil commented Feb 22, 2019

Thanks for the report @onomated. I don't have time for this right now but other maintainers may be able to. A PR would also be accepted.

@onomated
Copy link
Contributor Author

I can take a pass at it. Only challenge may be generating a test for it, but I'll look through the tests you have. Thanks!

@samsondav
Copy link
Owner

Don't worry too much about a test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants