本文介绍了Heroku Postgres错误:PGError:错误:关系“组织”不存在(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上运行。
解决方案
我遇到了同样的问题。为了解决这个问题,重置数据库更容易。
- heroku rake db:reset('heroku run rake db:reset'if you'
- heroku rake db:migrate('heroku run rake db:migrate'如果您使用雪松)
然后,迁移成功完成了我的情况:)
虽然这是一个很好的解决方案,但不要这样做在生产上。它会删除数据库中的所有记录
I'm having a problem deploying my Rails app to Heroku, where this error is thrown when trying to access the app:
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
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' if you're on cedar)
- heroku rake db:migrate ('heroku run rake db:migrate' if you're on cedar)
Then, migration was done successfully for my case :)
While this is a good solution in this context, don't do it on production. It will delete all the records from your database
这篇关于Heroku Postgres错误:PGError:错误:关系“组织”不存在(ActiveRecord :: StatementInvalid)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!