postgresql - 如何手动更改heroku数据库中的记录

标签 postgresql ruby-on-rails-4 heroku heroku-toolbelt

我在 heroku 中托管了一个 Rails 应用程序。我有一个带有内容列的问题表。内容列包含问题的词。因此,例如,如果您查询。 Question.first.content,你会得到“你好,你好吗?”。我总共有8个问题。我想手动进入数据库并更改这些问题。

我尝试使用以下命令在 heroku 上运行终端:

heroku pg:psql

并且我使用这个查询来更改记录的内容列

UPDATE Questions
SET content="What country does this story orginate? (Japan)"  

但是我收到这个错误信息:

ERROR: column "What country does this story orginate? (Japan)" does not exist
LINE 2: SET content="What country does this story orginate? (Japan)"...

更改问题内容栏的正确查询是什么?

最佳答案

事实证明我可以heroku run console。进入控制台后,我可以进行事件记录查询,例如 Question.find(1).update_attributes(:content=>'how are you?') 并进行更新。无论出于何种原因,heroku run rails console 都没有使用事件记录查询更新记录,只是返回查询成功。

关于postgresql - 如何手动更改heroku数据库中的记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30279202/

相关文章:

postgresql - 使用 palloc 分配

postgresql - 如何获取 JSONB 列上的值的总和

ruby-on-rails - Rails 4,新应用程序 : Why do tests run in development environment?

node.js - 错误 : Procfile does not exist, 和启动 Web 进程时出现问题

git - GitHub 上的 ParsePlatform 上的 Parse-server 和 Parse-server-example 有什么区别?

heroku - 使用 CNAME 时是否可以创建正确的 SPF 和 DMARC DNS 记录?

ruby-on-rails-3 - 如何将一整天与日期时间字段匹配?

postgresql - 索引数组以进行全文搜索

ruby-on-rails - 在评论中提及用户用户名 (@mention) - Rails

jquery - Rails Assets 预编译 : Invalid CSS in jquery. scrollbar.css 背景图片