I\'m trying to fire up rails dbconsole
on Heroku but get the following error:
heroku run rails dbconsole
# => Couldn\'t find database client: psq
I think heroku-sql-console should provide similar functionality, but when I tried running it I got this error:
undefined local variable or method `app' for # (NameError)
It's been reported as a bug but there's no fix or workaround.
Update: As @Alban suggests, the fix to this problem is to update the client. I had to run gem update heroku
to do this.
https://devcenter.heroku.com/articles/heroku-postgresql - "You must have PostgreSQL installed on your system to use heroku pg:psql". So maybe you're missing PostgreSQL on your machine. If that's not the case, then try this other command to get to the Postgres console instead:
heroku pg:psql
"psql is the native PostgreSQL interactive terminal and is used to execute queries and issue commands to the connected database."
Is it possible to use the dbconsole on Heroku? If not is there another client that can be used?
You can use online database client if you use activeadmin
.
Just add the gem activeadmin-sqlpage:
gem 'activeadmin-sqlpage'
And create activeadmin page:
# file app/admin/sql.rb
ActiveAdmin::SqlPage::register
Restart your server. Then go to admin panel and navigate the menu SQL
. Enter any sql command and press Ctrl+Enter
or Submit
button.
As Luke says, you may use heroku-sql-console. But first make sure you are using the latest heroku client:
> heroku update