Skip to content

Loading…

ActiveRecord::StatementInvalid (Could not find table 'delayed_jobs') #12

Closed
ghost opened this Issue · 1 comment

1 participant

@ghost

Hey guys,

When some application set AR configurations below:

active_record.table_name_prefix = "my_app_"
active_record.table_name_suffix = ""

and run migrations, AR creates a table with name "my_app_delayed_jobs"

Then DJ AR Backend try to query with name "delayed_jobs" and you get the Error:
ActiveRecord::StatementInvalid (Could not find table 'delayed_jobs'):
or
ActiveRecord::JdbcError (query does not return ResultSet):
If application using activerecord-jdbc-adapter

Is it possible to set DJ table name with AR prefix and suffix configs?
something like this:

self.table_name = "#{::ActiveRecord::Base.table_name_prefix}delayed_jobs#{::ActiveRecord::Base.table_name_suffix}"

Using

  • delayed_job (3.0.1)
  • delayed_job_active_record (0.3.2)
  • rails (3.1.3)
  • activerecord (3.1.3)
@ghost

For Rails applications an alternative fix is set DJ table name on application.rb like:
Delayed::Backend::ActiveRecord::Job.table_name = "my_app_#{Delayed::Backend::ActiveRecord::Job.table_name}"

@albus522 albus522 closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.