Errors in evolutions on Heroku Errors in evolutions on Heroku heroku heroku

Errors in evolutions on Heroku


If you're sending to Heroku 1.sql file generated for H2, there is big chance that they will conflict, instead, set the Heroku's url in application.conf as db.default.url and run it in dev mode on localhost first to generate valid Postres SQL. Also you will need to comment out the db.default.user and db.default.password settings, as Heroku's URL contains this information already.

If you don't know current connection's URL you will find it on:

https://postgres.heroku.com/ -> YourDBs -> db-name -> Connection settings -> JDBC URL

To connect from localhost (or other machine, not in the Heroku's space) you need to add this param to the URL:

&ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory

Thanks to this approach you can test your application locally with established connection to the remote Heroku's DB, (don't be surprised - that combination will be much slower than working with local app + local DB or Heroku app + Heroku DB) anyway for testing it's better than repeatedly pushing small fixes to the cloud.

Also you'll be able to perform evolutions from localhost - without pushing the code to Heroku, and it's really shorter approach if you have problems in your SQL.

Additionally it's good occasion to turn on SQL logging in local dev mode and hunt for redundant SQL queries, if you'll remove all not necessary queries and will be satisfied on localhost, after deploying to the Heroku, you will be just much more satisfied :)

Reset

If you'll create proper 1.sql file than most probably you'll need to reset your DB containing invalid structure (as I assume that's not a problem yet as you just moving from local to Heroku). First find a name of the DB for the current app (with bash, in app's folder):

heroku pg

And then reset it with (it will destroy all data so consider backup first if you don't want to loose your data!):

heroku pg:reset HEROKU_DATABASE_SOMEBASE


I think you have some problem with the definition in VALUES with the data time field. I posted my working evolutions config setup for play 2.4, Slick 3.0.3 & postgres. I got automatically generated the *.sql files placed in the evolution folder.

Regenerate evolution scripts in play 2

Cheers