Script to update Heroku PostgreSQL DB connection in Metabase

If you've used (PostgreSQL) databases on Heroku in Metabase, you may have found that you need to upgrade the database connection details in Metabase now and then. This happens, for example, when you've done a major database upgrade by copying to a new database.

Here's a script to get the DATABASE_URL from a Heroku app and update the Metabase database details accordingly. A secondary follower database is also supported. You can add multple lines with mb_updatedb to update multiple databases at once.

Can be a great timesaver when managing multiple databases.

1 Like