Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I check the records of my heroku database?

I've just deployed my application to heroku and pointed my custom domain to the heroku servers. How can I check the records in my heroku database?

like image 955
Justin Meltzer Avatar asked Apr 28 '11 21:04

Justin Meltzer


People also ask

Where can I find Heroku database?

All Heroku Postgres databases have a corresponding Heroku application. You can find the application name on the database page at data.heroku.com. Your database is attached to the Heroku app and is accessible via an app config var containing the database URL, even if you host no code in the application itself.

How can I see my table in Heroku Postgres?

From the application dashboard on Heroku, go to the 'resources' tab and search for postgres. Provision it and use the free option. There's now a clickable link to the Datastore associated with your application. Go ahead and open the link to your datastore, and take note of exactly how to get here again.

Does Heroku save database?

Heroku Postgres delivers the world's most advanced open source database as a trusted, secure, and scalable service that is optimized for developers.


2 Answers

You can use heroku run rails console and look at your records with Model.all or any other method.

If you want to backup the database look at heroku PG backups, you then can import your database on your local machine and look at it there. Depending on your db adapter you could use sqlite browser for sqlite3 or phpmyadmin for MySQL.

like image 57
Andre Schweighofer Avatar answered Oct 09 '22 03:10

Andre Schweighofer


I found a similar question like this and here is what @Chowlett says:

"You could run heroku pg:psql to fire up a Postgres console, then issue \d to see all tables, and \d tablename to see details for a particular table."

You can also type select * from tablename; to view the table contents.

How to view current database schema for Heroku app in Terminal?

like image 22
Daniel Avatar answered Oct 09 '22 03:10

Daniel