timpone
timpone

Reputation: 19929

heroku error when trying to run migration

First time using heorku. Code is deployed to heroku and non db pages are rendering fine. I get this error and I'm not sure why:

irb(main):004:0> heroku run rake db:migrate
NameError: undefined local variable or method `migrate' for main:Object
    from (irb):4

It's currently unclear to me whether heroku ran migrations since anything simple like

User.first

is giving me an error like this:

irb(main):005:0> User.first
PG::Error: ERROR:  relation "users" does not exist
LINE 5:              WHERE a.attrelid = '"users"'::regclass
                                        ^
:             SELECT a.attname, format_type(a.atttypid, a.atttypmod),

Thx in advance for any help. What would be next step to debug this?

Upvotes: 0

Views: 281

Answers (1)

benchwarmer
benchwarmer

Reputation: 2774

You are not supposed to run that command into Rails console. You can run that command into shell inside project's directory.

heroku run rake db:migrate --app my_awsome_app

--app is optional

Upvotes: 3

Related Questions