如何在终端中查看Heroku应用程序的当前数据库模式? [英] How to view current database schema for Heroku app in Terminal?
问题描述
我正在试图在终端(Mac OS X Lion)中查看我的Heroku应用程序的模式,并偶然发现了一个可以做到这一点的命令。在终端中,我运行 heroku运行多个db / schema.rb
,但似乎显示的是较旧的模式版本。我刚刚迁移了Heroku数据库,并注意到没有列出任何新列。
I am trying to view my Heroku app's schema in Terminal (Mac OS X Lion) and stumbled upon a command that does just that. In Terminal, I run heroku run more db/schema.rb
but it seems to display an older schema version. I just migrated the Heroku db and I noticed that none of the new columns are listed.
我似乎无法在Heroku的文档中找到任何有用的信息。有人知道一个命令来查看Heroku应用程序的当前数据库模式吗?
I can't seem to find anything helpful in Heroku's documentation. Does anyone know a command to view the current database schema for a Heroku app?
顺便说一下,我继承了应用程序的代码,并且由于某种原因,所有的迁移文件被注释掉了(可能有40多个文件),所以我不能在本地运行 rake db:migrate
来更新模式;因此,我希望直接看到Heroku应用程序的架构。
By the way, I inherited the code for the app and for some reason all of the migration files are commented out (there are probably 40+ files) so I can't just run rake db:migrate
locally to update the schema; hence, I'd like to see the Heroku app's schema directly.
有什么建议吗?
Any suggestions?
推荐答案
您可以运行 heroku pg:psql
来启动Postgres控制台,然后发出 \ d
查看所有表,
You could run heroku pg:psql
to fire up a Postgres console, then issue \d
to see all tables, and \d tablename
to see details for a particular table.
这篇关于如何在终端中查看Heroku应用程序的当前数据库模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!