How to solve PG::UndefinedTable: ERROR: relation "table" does not exist issue

If anyone ever encounter the following error it means the code-base is expecting a table to be existed even before the migration. This is of course bad coding. In my case I was installing an old project and was stuck with the following error in rails.

Error:

rake aborted! PGError: ERROR: relation "delayed_jobs" does not exist In the project it was using gem delayed_job_active_record. It turns out that in the code-base it was expecting the delayed_jobs table.

Solution

In the code-base I had to comment out all lines from the following file: config/initializers/schedule_jobs.rb Afterwords I ran the rake db:migrate and it worked!

Comments