Skip to content

Instantly share code, notes, and snippets.

@PlanetRoast
Last active November 11, 2015 22:18
Show Gist options
  • Save PlanetRoast/84e2f51f9328d35c0e8d to your computer and use it in GitHub Desktop.
Save PlanetRoast/84e2f51f9328d35c0e8d to your computer and use it in GitHub Desktop.

Access rails console through the terminal

heroku run rails console --app APPNAME

Rake your database through the terminal

heroku run rake db:migrate --app APPNAME

Access PSQL databases through the terminal

heroku pg:psql --app yourappname DATABASE

Empty the database

heroku pg:reset DATABASE --app appnamehere

Push local database up to heroku

Note that you'll have to do a pg:reset before you're able to push data into a Heroku database. If you are asked for a password which you don't remember setting up when you installed psql don't worry, you didn't forget anything. PSQL will need a password set for whatever role you're using. Check out the PSQL cheat sheet for both of these.

heroku pg:push alancharles_co_development HEROKU_DATABASE_NAME --app appnamehere

Can't find the database? Try using DATABASE_URL instead of the name of the database. You don't have to get an actualy URL, just literally put DATABASE_URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment