Ivan Fernandez
Ivan Fernandez

Reputation: 4533

Postgres dev in Heroku doesn't create any table

I'm trying to deploy a basic java application with Postgres integration in Heroku. I've cloned this project https://github.com/heroku/devcenter-java-database. I was able to make the app work in a proper way locally. It creates a table called ticks within the database and a tuple is inserted in it.

When I deploy the app to Heroku, it seems to work as well. In fact, it works. I can run a select query and get the right result. The strange thing comes up when I try to check my postgres db in Heroku. It seems nothing has been created. I don't know if it's caused because I have a Heroku's Dev plan. But I don't have any ideas why Heroku behaves different than my local env.

::term>run "sh devcenter-java-database-plain-jdbc/target/bin/main"
  Running sh devcenter-java-database-plain-jdbc/target/bin/main attached to terminal...      up, run.6018
  Read from DB: 2013-02-03 12:51:42.110186

The app works, but it doesn't save anything in my Heroku db.

::term>pg:info
  ===HEROKU_POSTGRESQL_WHITE (DATABASE_URL)
  Plan         Dev
  Status       available
  Connections  0
  PG Version   9.1.6
  Created      2013-02-03 11:58 UTC
  Data Size    5.9 MB
  Tables       0
  Rows         0/10000 (In compliance)
  Fork/Follow  Unsupported

Any ideas?

Upvotes: 1

Views: 1393

Answers (1)

GregB
GregB

Reputation: 1656

pg:info queries Heroku's Postgres management systems, which is only periodically polling your dev db. pg:info is not real time, but your app is. If it works, your table and data is there.

Upvotes: 1

Related Questions