canvas-lms icon indicating copy to clipboard operation
canvas-lms copied to clipboard

PG::Error: ERROR: relation "delayed_jobs" does not exist

Open nkokkos opened this issue 12 years ago • 8 comments

Hi, there, thanx for opensourcing this great app.

I have been trying to no avail, to run the migrations, but it always fails at:

== CleanupDelayedJobsIndexes: migrating ====================================== rake aborted! An error has occurred, this and all later migrations canceled:

PG::Error: ERROR: relation "delayed_jobs" does not exist : CREATE INDEX get_delayed_jobs_index ON delayed_jobs (priority, run_at, failed_at nulls first, locked_at nulls first, queue)/home/nikos/rails_projects/canvas-lms/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.15/lib/active_record/connection_adapters/postgresql_adapter.rb:650:in `exec'

Have you experienced this before?

I have followed the instructions step by step but can not figure out why it failed at delayed_jobs.

Delayed_jobs plugin should be loaded from the plugins folder and delayed_jobs table should be created at the very second migration.

Have you any ideas?

nkokkos avatar Jan 31 '14 09:01 nkokkos

Getting into the rails console after the migration fails and typing:

ActiveRecord::Base.connection.tables.include 'delayed_jobs' 

gives me true, which means that 'delayed_jobs' table has already been created.

nkokkos avatar Jan 31 '14 13:01 nkokkos

How about Delayed::Job.connection.tables.include?('delayed_jobs')? And what are the contents of your config/database.yml (sans passwords)?

ccutrer avatar Jan 31 '14 16:01 ccutrer

Hi. Thanx for your reply

This is what I get:

Delayed::Job.connection.tables => []

Delayed::Job.connection.tables.include?('delayed_jobs') => false

My database.yml is the same as your database.yml.example, but in my case I have replaced 'canvas' user by my name 'nikos'

'nikos' is a postgres user and has full access in postgres databases (canvas_test, canvas_development. etc). I have also created a linux user 'nikos', and I am trying to run the migration logged in a 'nikos'

Here's my database.yml:

test: adapter: postgresql encoding: utf8 database: canvas_test host: localhost username: nikos timeout: 5000

test-in-memory: adapter: sqlite3 encoding: utf8 database: ':memory:' pool: 1

development: adapter: postgresql encoding: utf8 database: canvas_development timeout: 5000 queue: adapter: postgresql encoding: utf8 database: canvas_queue_development timeout: 5000

production: adapter: postgresql encoding: utf8 database: canvas_production host: localhost username: nikos password: nikos timeout: 5000 queue: adapter: postgresql encoding: utf8 database: canvas_queue_production host: localhost username: nikos password: nikos timeout: 5000

nkokkos avatar Feb 03 '14 08:02 nkokkos

So, it sounds like for some reason the delayed jobs tables were originally created in the main database, not the queue database. Then when a later migration tries to update the table, it's using the queue database, and can't find it. If this isn't going to be a production instance, I'd recommend just removing the queue section from database.yml.

ccutrer avatar Feb 03 '14 22:02 ccutrer

It's just an installation for trying things out. It seems to me that

 def self.connection
    Delayed::Backend::ActiveRecord::Job.connection
  end 

in

db/migrate/20101216224513_create_delayed_jobs.rb

does not respect Delayed::Backend::ActiveRecord::Job.connection which points to the correct queue database.

By the way, I am trying to install canvas using rails3 and I am getting some weird errors. I will try to report them. Thank you.

nkokkos avatar Feb 05 '14 09:02 nkokkos

Ah, that might explain it. Rails 3 is definitely not supported yet. We're working hard on it, but there are thousands of problems.

ccutrer avatar Feb 05 '14 16:02 ccutrer

Ok, thanx for looking into this. I'll switch to rails 2 for the time being.

nkokkos avatar Feb 12 '14 08:02 nkokkos

@nkokkos I'm going to go ahead and close this issue. It seems you've probably got it figured out. Also, Rails 3 is now supported by Canvas. If you have further issues feel free to reopen the issue.

claydiffrient avatar Feb 26 '15 16:02 claydiffrient