bo-oz
bo-oz

Reputation: 2872

Strange error when pushing app to heroku

I'm new to pushing an app to production. I chose Heroku as my production environment. When I try to git push heroku master, I get the following error log. Any ideas on what might be causing this?

remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        PG::UndefinedTable: ERROR:  relation "steps" does not exist
remote:        LINE 5:                WHERE a.attrelid = '"steps"'::regclass
remote:        ^
remote:        :               SELECT a.attname, format_type(a.atttypid, a.atttypmod),
remote:        pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
remote:        FROM pg_attribute a LEFT JOIN pg_attrdef d
remote:        ON a.attrelid = d.adrelid AND a.attnum = d.adnum
remote:        WHERE a.attrelid = '"steps"'::regclass
remote:        AND a.attnum > 0 AND NOT a.attisdropped
remote:        ORDER BY a.attnum
remote:        rake aborted!

I do have a table called steps defined in my migration files, and the site is working perfectly on development.

Upvotes: 0

Views: 57

Answers (3)

RuNpiXelruN
RuNpiXelruN

Reputation: 1920

As mentioned by @sheltond, Heroku requires you to have a couple of gems installed. If you haven't done so already add the following to your gemfile and run bundler

group :production do
    gem 'pg'
    gem 'rails_12factor'
end

Upvotes: 2

sheltond
sheltond

Reputation: 1937

If you find that you can't run "rake" on Heroku, you should be able to run it locally if you set up the environment correctly.

Usually, Heroku overwrites the database settings for your app when you deploy to point to the postgres database that you've configured for your app.

However, if you use "heroku config", you can see what the database settings are. If you copy these into config/database.yml under the "production" configuration, you should be able to run things like:

RAILS_ENV=production rake db:migrate

and it should update the Heroku postgres database.

You need to make sure that you've got the postgres database gems installed locally in order for this to work.

Upvotes: 1

RuNpiXelruN
RuNpiXelruN

Reputation: 1920

Try running the command heroku run rake db:migrate Then re-push and see if it works.

Upvotes: 3

Related Questions