JobDispatcher error with custom jobs_table_name
onomated opened this issue · 3 comments
onomated commented
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 commented
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 commented
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 commented
Don't worry too much about a test.