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?
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With