Heroku Postgres 错误:PGError:错误:关系“组织"不存在 (ActiveRecord::StatementInvalid) [英] Heroku Postgres Error: PGError: ERROR: relation "organizations" does not exist (ActiveRecord::StatementInvalid)
问题描述
我在将 Rails 应用程序部署到 Heroku 时遇到问题,在尝试访问应用程序时抛出此错误:
I'm having a problem deploying my Rails app to Heroku, where this error is thrown when trying to access the app:
PGError: ERROR: 关系organizations"不存在 (ActiveRecord::StatementInvalid)
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
有人有什么想法吗?这对我来说是第一次,特别是因为我已经在其他应用程序上使用 Heroku 工作了一年,还没有看到类似的东西.当然,一切都在本地 SQLite 上运行.
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.
推荐答案
我遇到了同样的问题.要解决它,重置数据库更容易.
I had the same problem. To solve it, resetting the database is more easier.
- heroku rake db:reset('heroku run rake db:reset' 如果你在 cedar 上)
- heroku rake db:migrate ('heroku run rake db:migrate' 如果你在 cedar 上)
然后,我的案例迁移成功:)
Then, migration was done successfully for my case :)
这篇关于Heroku Postgres 错误:PGError:错误:关系“组织"不存在 (ActiveRecord::StatementInvalid)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!