Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku Postgres Error: PGError: ERROR: relation "organizations" does not exist (ActiveRecord::StatementInvalid)

I'm having a problem deploying my Rails app to Heroku, where this error is thrown when trying to access the app:

PGError: ERROR: relation "organizations" does not exist (ActiveRecord::StatementInvalid)

SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d   ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"organizations"'::regclass   AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum 

Anybody have any ideas? This is a first for me, especially because I've been working with Heroku for a year on other apps, and haven't see anything like this. Of course, everything works on local SQLite.

like image 240
Mark Avatar asked Mar 27 '11 17:03

Mark


2 Answers

I had the same problem. To solve it, resetting the database is more easier.

  • heroku rake db:reset ('heroku run rake db:reset' if you're on cedar)
  • heroku rake db:migrate ('heroku run rake db:migrate' if you're on cedar)

Then, migration was done successfully for my case :)

While this is a good solution in this context, don't do it on production. It will delete all the records from your database

like image 73
akipponn Avatar answered Sep 30 '22 05:09

akipponn


I've had the same problem until I realized that I had to do:

heroku rake db:migrate 

:)

like image 40
Victor S Avatar answered Sep 30 '22 06:09

Victor S