-1

I am learning ruby on rails and heroku. I have some questions. Could somebody help me?

  1. After running heroku create, the terminal is somehow connected to the repository/project in heroku. After that the developer can see logs, access database, ect. But, how can I access via terminal my completed project,which is online already, in heroku without creating the same apps and upload it again to heroku?
  2. How can access my pg database in heroku or offline? I saw this and try to run heroku pg:psql. it gives me hidden-atoll-4790::DATABASE=> help I try \? to see pg command but I cannot use it.
  3. I saw this link to see pg db offline. But why cannot I access /var/lib/postgresql/9.3/main directory ? it is said that I don't have permission eventhough my account is administrator account.
Community
  • 1
  • 1
Codelearner777
  • 313
  • 3
  • 15

2 Answers2

0

1.Run heroku run rails console

weezing
  • 396
  • 1
  • 8
  • 22
  • Code-only answers are not as helpful as answers that have working code plus helpful explanations. In this case, it would be worthwhile explaining this answer to a 5 year old. – Somnath Muluk Nov 07 '15 at 07:10
  • thanks. Last night I figured out this the-name-of-the-model.all. it helps me to see inside the db though I still do not know another query commands. – Codelearner777 Nov 08 '15 at 02:11
  • @Codelearner777 so if my answer was helpful, please mark it as acepted, and if you have further questions please ask it in new thread – weezing Nov 18 '15 at 12:15
  • @weezing, thanks for your answer but that is not what I want to know :) – Codelearner777 Nov 20 '15 at 16:50
0

Run

$ heroku apps # to see all apps created by your account
$ heroku open # to open you current project in browser (run it form root of your project)
$ heroku pg:psql DATABASE_URL # to gain access to heroku postgresql terminal, here you can run SQL queries

Refer to

CLI and Heroku PG for more info

Rahul Singh
  • 3,417
  • 2
  • 25
  • 32