user971741
user971741

Reputation:

Where is the heroku database?

I am trying to host my php application over heroku cloud services. This is my first ever try with any GIT client; following the procedure as defined in heroku documentation, I am done with pushing my files to the repo.

But now one place where I am totally lost is where is the heoku database, how can I configure it?

I went through myapp>resources where it tells the 5mb of database can be used for free, the only clickable link there is the 5mb label but even that is not taking me anywhere.

But where is the control panel of that database, where I can edit and use sql to configure my database? Finds its name, username etc. (may be an interface like phpmyadmin)?

Kindly guide me through this.

Thank you.

Upvotes: 2

Views: 2361

Answers (4)

jake
jake

Reputation: 1665

I was looking for something like phpmyadmin for heroku databases, and I found the Adminium add-on, which works in a similar way.

Much easier than console.

Upvotes: 4

Kristian Glass
Kristian Glass

Reputation: 38530

There is no "control panel" for the Heroku database. As for "where is it", there is a SHARED_DATABASE_URL environment variable of the form:

$ heroku config | grep DATABASE
SHARED_DATABASE_URL   => postgres://username:password@host:port/database_name

In your PHP code, you can get this like so:

$database_url = getenv('SHARED_DATABASE_URL');

You may need to do some parsing of that URL to get it into a format that your PHP database API needs (it's been a while since I wrote any PHP).

As for "how do I configure my database", either from the command line, e.g.

$ heroku run php

or, assuming your code has some ORM-y features, invoking that to set up the database schema, or using heroku's db:push command, e.g.:

$ heroku db:push [URL_TO_MY_LOCAL_SOURCE_DATABASE]

Upvotes: 3

michaelward82
michaelward82

Reputation: 4736

Heroku will automatically setup your access to the database.

You may use taps to push and pull data betweeen your development machine and heroku. See http://devcenter.heroku.com/articles/taps

Alternateively, you may use pgbackup - http://devcenter.heroku.com/articles/pgbackups

Heroku recommends pgbackup as the most complete way of handling your database data (as described on the taps page).

Upvotes: 1

Chris Shanks
Chris Shanks

Reputation: 47

Usually when you push something to Heroku it is the production side of the application, so it has a separate database that uses the same schema that you have designed once it has been migrated over. So all your data will need re-entering through the Heroku App which can be found at: 'app name'.herokuapp.com

Upvotes: 0

Related Questions