Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

heroku fork doesn't recognize a primary database properly #19

Open
keiko713 opened this issue May 10, 2016 · 4 comments
Open

heroku fork doesn't recognize a primary database properly #19

keiko713 opened this issue May 10, 2016 · 4 comments

Comments

@keiko713
Copy link

When you have a database that is a primary but under the certain circumstances, heroku fork will create a new database within a new app, and do not make it as a primary database within the new app, which will end up copying the old app's DATABASE_URL to the new app. Now your forked app will be pointing to the original app's database, which can cause a nightmare.

Here is roughly what happens:

The reason of the old app's AMBER is not recognized as DATABASE_URL is a long story but it can certainly happen. One workaround that I can think of is to promote such database after the creation manually so that the new app will have a proper DATABASE_URL.
I don't think I'm explaining the issue well enough here, please ping me if you have nay questions. Also I'm happy to discuss about potential fixes.

@ccmcbeck
Copy link

ccmcbeck commented Jul 21, 2016

I have the exact same problem and https://devcenter.heroku.com/changelog-items/438 suggests that changing an add-on should work, but you can't run addons:upgrade for heroku-postgresql. It complains "Upgrades are not supported by the heroku-postgresql addon. Add a second plan, migrate your data, then remove this plan." Wonder what the magic add-on would be? Maybe we just have to update DATABASE_URL ourselves?

@keiko713
Copy link
Author

keiko713 commented Aug 4, 2016

@ccmcbeck sorry to hear that you hit this issue. In your case, please run heroku pg:promote HEROKU_POSTGRESQL_<COLOR>. This will make database to be DATABASE_URL.

@ccmcbeck
Copy link

ccmcbeck commented Aug 4, 2016

Interesting. That does create DATABASE_URL, but it also removes HEROKU_POSTGRESQL_. I guess that is by design.

From: Keiko Oda [email protected]
Reply-To: heroku/heroku-fork [email protected]
Date: Wednesday, August 3, 2016 at 6:27 PM
To: heroku/heroku-fork [email protected]
Cc: Chris Beck [email protected], Mention [email protected]
Subject: Re: [heroku/heroku-fork] heroku fork doesn't recognize a primary database properly (#19)

@ccmcbeckhttps://github.com/ccmcbeck sorry to hear that you hit this issue. In your case, please run heroku pg:promote HEROKU_POSTGRESQL_. This will make database to be DATABASE_URL.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com//issues/19#issuecomment-237424775, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAhWKsW2C93a8x5i-GsFgOad2us617f6ks5qcT__gaJpZM4IbYCi.


This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com



This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com


@nekopanic
Copy link

Just picked up another one as well. It looks like this:

  • Original app - perform a pg:copy upgrade and use heroku config:set to set DATABASE_URL.
  • Fork the app - it forks the colour database, but copies DATABASE_URL.

End result is a forked app with a new database but DATABASE_URL pointing to the original DB.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants