我在 Nitrous.io 上托管的应用程序上使用 Heroku Postgres。该应用程序运行,但给我以下错误:
PG::Error: ERROR: relation "users" does not exist
LINE 5: WHERE a.attrelid = '"users"'::regclass
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"users"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
因此,在阅读之后,我尝试运行heroku run rake:db reset --app app_name
,但出现以下错误:
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/usr/local/lib/ruby/1.9.1/rake.rb:2367:in `raw_load_rakefile'
/usr/local/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
/usr/local/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/usr/local/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
/usr/local/lib/ruby/1.9.1/rake.rb:1991:in `run'
/usr/local/bin/rake:31:in `<main>'
由于我没有在 Heroku 上托管应用程序,因此我对我应该做什么感到困惑。我只需要为我的应用程序设置我的表。这是我的database.yml:
development:
adapter: postgresql
encoding: unicode
pool: 5
database: <%= ENV['CHAKRA_DEV_DATABASE'] %>
username: <%= ENV['CHAKRA_DEV_USER'] %>
password: <%= ENV['CHAKRA_DEV_PASSWORD'] %>
host: <%= ENV['CHAKRA_DEV_HOST'] %>
port: <%= ENV['CHAKRA_DEV_PORT'] %>
我的 .bashrc 在底部如下所示:
### Heroku Postgres Details
export CHAKRA_DEV_HOST=ec2-******.compute-1.amazonaws.com
export CHAKRA_DEV_DATABASE=df2cokjfj0k4vu
export CHAKRA_DEV_USER=zgwgf****rhyn
export CHAKRA_DEV_PORT=5432
export CHAKRA_DEV_PASSWORD=JAImDWqN****4k7VOhUpLmbn
我尝试从我的应用程序文件夹中运行 heroku run rake db:migrate ,但它不起作用。相反,我尝试使用应用程序名称应该去的 Heroku postgres DB 的名称。有什么建议吗?