Reputation: 359
I've created a new database in Heroku, showing in my dashboard; when I go to settings, it does not allow me to rename, stating 'Internal Server Error'. What can I do to rename my database?
Upvotes: 14
Views: 10743
Reputation: 3113
It may be clearer to think of it this way:
You can rename an app
heroku apps:rename --app OLDNAME NEWNAME
You can rename an addon (in your case, postgres instance):
heroku addons:rename OLDNAME NEWNAME
To find the current name, do heroku addons
.
But you also have to understand heroku aliases. These are how heroku automatically sets config vars for you (its the config vars which the aliases set that you see in your settings page). Here are the docs. In a nutshell, you can't actually rename an alias directly, but you can add a second alias pointing to the same place, then remove the old one. See here.
Upvotes: 15
Reputation: 647
It looks like the method for renaming a Heroku DB has changed since this was last updated; the answer given in this reply is no longer valid.
I've spoken with Heroku support, and the current way to rename a Heroku DB is using the heroku addons:rename
command (you can look up some brief CLI help on it with the command heroku help addons:rename
.)
For example: if your DB is named postgresql-loudly-9983
and is attached to the app bumping-softly-6892
, and you'd like to rename it to stats-db
, your command would be the following:
heroku addons:rename postgresql-loudly-9983 stats-db -a bumping-softly-6892
Upvotes: 25
Reputation: 178
You can do it now in the web interface go to Apps, click on settings and you will have a rename button.
Upvotes: 0
Reputation: 35
You can use the heroku command line:
$ heroku apps:rename <old app name> <new app name>
Upvotes: 1
Reputation: 346
Just received this response from a heroku postgres engineer:
We've recently updated how we handle database names on postgres.heroku.com. In the past, all databases had a "label" you could simply change, and an internal "hidden" Heroku application that your database was attached to. The change we've deployed removes the label, and un-hides the heroku app name. The name you see on postgres.heroku.com is a full Heroku app that you can interact with via the command line or dashboard.heroku.com.
If you'd like to rename it, you can use the dashboard.heroku.com or $ heroku app:rename
from the command line.
Upvotes: 1