Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change DATABASE_URL for a heroku application

I wanted to use an external Database with my heroku application. But I'm unable to edit the configuration cariables. I tried using GUI, Which says, Cannot overwrite attachment values DATABASE_URL. While I tried using CLI as well. I used the command: heroku config:addDATABASE_URL="postgresql://username:password@IP:PORT". However, this throws an error ... is not a heroku command.

like image 201
Ninja Boy Avatar asked Jan 28 '16 12:01

Ninja Boy


People also ask

What is Database_url in Heroku?

DATABASE_URL contains the URL your app uses to access the database. If your app already has a Heroku Postgres database and you've provisioned another one, this config var's name instead has the format HEROKU_POSTGRESQL_<COLOR>_URL (for example, HEROKU_POSTGRESQL_YELLOW_URL ).

What is connection limit in Heroku?

Heroku provides managed Postgres databases. Different tiered databases have different connection limits. The Hobby Tier databases are limited to 20 connections. Standard and higher tier databases have higher limits.


1 Answers

After trying out most these answers, I came across an update in 2016, here: the database needs to be detached first, then update the variable of the DATABASE_URL.

heroku addons:attach heroku-postgresql -a <app_name> --as HEROKU_DATABASE heroku addons:detach DATABASE -a <app_name> heroku config:add DATABASE_URL= 
like image 131
0bserver07 Avatar answered Sep 21 '22 05:09

0bserver07