【发布时间】:2016-12-27 00:59:05
【问题描述】:
我刚刚将我在 Cloud9 中构建的 Rails 应用程序启动到 Heroku(哇哦!)。我的默认数据库是 sqlite3,所以在部署过程中,我在我的 gem 中添加了 PostgreSQL:
# Use postgresql as the database in production
group :production do
gem 'pg'
end
# Use sqlite3 as the database in development
group :development do
gem 'sqlite3'
end
我想将我的 sqlite3 数据库保持在开发中,并将 PostgreSQL 用于生产。我的问题是如何在我的生产 Heroku 站点中监控或运行对 PostgreSQL 数据的查询。
我习惯于在终端中运行“rails c”然后运行“User.all”来查看我的用户。现在,如果我运行它,它不会显示任何生产数据。我如何查看这些数据?我做了一些搜索,我想我应该使用“psql”命令。但是,例如,如果我运行“psql -l”,我会得到:
psql: could not connect to server: Connection refused
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
【问题讨论】:
标签: ruby-on-rails postgresql heroku sqlite