简体   繁体   English

尝试运行迁移时出现heroku错误

[英]heroku error when trying to run migration

First time using heorku. 第一次使用heorku。 Code is deployed to heroku and non db pages are rendering fine. 代码已部署到heroku,非db页面呈现良好。 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 目前我还不清楚heroku是否进行了迁移,因为类似

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? 下一步要调试什么?

You are not supposed to run that command into Rails console. 您不应该在Rails控制台中运行该命令。 You can run that command into shell inside project's directory. 您可以将该命令运行到项目目录中的shell中。

heroku run rake db:migrate --app my_awsome_app

--app is optional --app是可选的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM