How to rename a database in Heroku?

I created a new database in Heroku, showing it in the toolbar; when I go to settings, it doesnโ€™t allow me to rename, indicating "Internal server error". What can be done to rename my database?

+4
source share
5 answers

It appears that the method for renaming the Heroku database has changed since the last update; The answer specified in > this answer is no longer valid.

I spoke with Heroku support, and in the current way to rename the Heroku database, the heroku addons:rename command is used (you can find a quick CLI help on it with the heroku help addons:rename command.)

For example: if your database is called postgresql-loudly-9983 and attached to the bumping-softly-6892 application, and you want to rename it to stats-db , your command will be as follows:

heroku addons:rename postgresql-loudly-9983 stats-db -a bumping-softly-6892

+5
source

It may be clearer to think of it this way:

  • You can rename the heroku apps:rename --app OLDNAME NEWNAME

  • You can rename the addon (in your case postgres instance): heroku addons:rename OLDNAME NEWNAME To find the current name, make heroku addons .

  • But you must also understand heroku aliases . Here's how the hero automatically installs configuration vars for you (its configuration vars, which set the aliases that you see on the settings page). Here are the docs . In a nutshell, you cannot rename an alias directly, but you can add a second alias pointing to the same place, and then delete the old one. See here .

+3
source

Just received a response from the hero postgres engineer:

We recently updated ways to handle database names at postgres.heroku.com. Previously, all databases had a โ€œlabelโ€ that you could just change, and an internal โ€œhiddenโ€ Heroku application to which your database was bound. The change we apply removes the shortcut and does not hide the heroku application name. The name you see on postgres.heroku.com is the complete Heroku app, which you can interact with through the command line or dashboard.heroku.com.

If you want to rename it, you can use dashboard.heroku.com or $ heroku app:rename from the command line.

+1
source

You can use the heroku command line:

$ heroku apps:rename <old app name> <new app name>

+1
source

You can do it now in the web interface go to "Applications", click "Settings", and you will have a rename button.

-one
source

Source: https://habr.com/ru/post/1499043/


All Articles