Heroku postgresql 数据库名称
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14141803/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Heroku postgresql database name
提问by LightBox
This is the command I have to find the name of a heroku database:
这是我必须找到heroku数据库名称的命令:
$ heroku config | grep POSTGRESQL
I get a result similar to:
我得到的结果类似于:
HEROKU_POSTGRESQL_NAVY_URL: postgres://wxjwilh:[email protected]:52/d14grmkt
which part of this output is the database name I can use with the command:
此输出的哪一部分是我可以与命令一起使用的数据库名称:
$ heroku pg:reset <DATABASE>
I tried using the whole url but got an invalid argument error.
我尝试使用整个 url,但出现无效参数错误。
回答by arvindwill
hope everyone confuses with placeholder and constant.
希望大家把占位符和常量混淆。
Assume having a db with name d6u5qhrlnbdfmp. then it is NOT necessary to type
假设有一个名为d6u5qhrlnbdfmp的数据库。那么没有必要输入
heroku pg:reset d6u5qhrlnbdfmp
Instead we can plainly type
相反,我们可以直接输入
heroku pg:reset DATABASE_URL
the sample output
样本输出
E:\git\stutzen>heroku pg:reset d6u5qhrlnbdfmp --app stutzen
! Unknown database: d6u5qhrlnbdfmp. Valid options are: DATABASE_URL, HEROKU_
POSTGRESQL_CYAN_URL
E:\git\stutzen>heroku pg:reset DATABASE_URL --app stutzen
! WARNING: Destructive Action
! This command will affect the app: stutzen
! To proceed, type "stutzen" or re-run this command with --confirm stutzen
> stutzen
Resetting HEROKU_POSTGRESQL_CYAN_URL (DATABASE_URL)... done
回答by Audrius Ka?ukauskas
URL consists of the following parts:
URL由以下部分组成:
scheme://username:password@host:port/database
So, in your case DB name is d14grmkt
.
因此,在您的情况下,数据库名称是d14grmkt
.
回答by ksu
I had a hard time to reset my database on Heroku. I post this, because I think it's the most straightforward solution. To find out the database name cd to your application folder and type:
我很难在 Heroku 上重置我的数据库。我发布这个,因为我认为这是最直接的解决方案。要找出数据库名称 cd 到您的应用程序文件夹并键入:
heroku pg:info
Output will be something like
输出将类似于
=== HEROKU_POSTGRESQL_BRONZE_URL
#other stuff
To reset the database type:
重置数据库类型:
heroku pg:reset HEROKU_POSTGRESQL_BRONZE_URL
you have to confirm with your application name.
您必须确认您的应用程序名称。
回答by Ray Shih
While using the command:
使用命令时:
$ heroku pg:reset DATABASE
$ heroku pg:reset DATABASE
It will tell you the available database name like this:
它会告诉您可用的数据库名称,如下所示:
! Unknown database: DATABASE_URL. Valid options are: HEROKU_POSTGRESQL_COPPER_URL, SHARED_DATABASE
! Unknown database: DATABASE_URL. Valid options are: HEROKU_POSTGRESQL_COPPER_URL, SHARED_DATABASE
so try the options it gave like this
所以试试它给出的选项
$ heroku pg:reset HEROKU_POSTGRESQL_COPPER_URL
$ heroku pg:reset HEROKU_POSTGRESQL_COPPER_URL
回答by IT_puppet_master
Late to the party, but if you need the db name, for example to add it as an addon to another instance, you run
迟到了,但是如果您需要数据库名称,例如将其作为插件添加到另一个实例,您可以运行
heroku addons
In the list you will see your postgres addon, in the 'Add-on' coloum is the name of the db app that is attached
在列表中,您将看到您的 postgres 插件,在“插件”栏是附加的 db 应用程序的名称