1

I developped my application locally with the default in memory h2 database. Everything works perfectly.

Now I tried to deploy my app by pushing to Heroku.

Before that I added a Procfile to my app's root folder with this line:

web: target/start -Dhttp.port=${PORT} -DapplyEvolutions.default=true -Ddb.default.url=${DATABASE_URL} -Ddb.default.driver=org.postgresql.Driver

My application.conf looks like:

db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play;MODE=PostgreSQL"

So I pushed that and then, when I try to access my app i get:

Salieri:addressManager administrator$ heroku ps
=== web (1X): `target/start -Dhttp.port=${PORT} -DapplyEvolutions.default=true -Ddb.default.url=${DATABASE_URL} -Ddb.default.driver=org.postgresql.Driver`
web.1: crashed 2013/06/27 22:04:16 (~ 4m ago)

and in the heroku logs:

2013-06-27T20:04:14.511136+00:00 app[web.1]: [error] play - ERROR: syntax error at or near "user"
2013-06-27T20:04:14.515578+00:00 app[web.1]: at play.api.db.evolutions.Evolutions$.databaseEvolutions(Evolutions.scala:334)
2013-06-27T20:04:14.515153+00:00 app[web.1]: @6emdb57b1: Database 'default' is in inconsistent state!

I tried to delete the whole db with

heroku pg:reset HEROKU_POSTGRESQL_ROSE_URL

and then i pushed again, but no success.

I have to mention that I did a push before, and at that time my app was running on Heroku. The only problem was, that i couldn't log in with the credentials provided in my fixtures (Global.java file with a job on app start).

Any suggestions?

2 Answers 2

0

From this error:

ERROR: syntax error at or near "user"

I guess your Evolution scripts are wrong. User is a reserved word in SQL. PLease try to run the Evolution scripts locally in a dev PostgreSQL database. Once working, you can try to deploy again.

I'd also suggest disabling evolutions for production apps, it's a risky system sometimes.

0

PostgreSQL interprets user as a keyword. If you have an app/models/User class in your app, play will try to create a table named user. The easiest way to avoid this is to rename your User class to something like MyUser. (The same might happen if you use an attribute named user in one of your classes. Here, as well, you should rename it).

Then you should run your application locally and open it in the browser in order to get the evolution script file updated. You can then find the evolution script at conf/evolutions/default/1.sql. According to this example, it should create a table named my_user now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.