Playframework 2.1 and Heroku update problems

我是研究僧i 提交于 2020-01-05 10:13:32

问题


i've create a play framework 2.1.0 project and deployed it on heroku. Last friday I've had to change the data models to add some extra fields. Once i tried to deploy the changes, it gave me evolution errors.

Unable to fixe the problem i've reverted the changed and deployed the old version but i still get an error.

The current error i'm getting is this

 database [default] connected at jdbc:postgresql: ...
 Position: 27 [ERROR:0, SQLSTATE:42601]
 ERROR: syntax error at or near "FALSE"
at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1$$anonfun$apply$1.apply$mcV$sp(Evolutions.scala:435)
Oops, cannot start the server.
at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.scala:434)
at play.api.db.evolutions.Evolutions$.evolutionScript(Evolutions.scala:306)
at scala.collection.immutable.List.foreach(List.scala:309)
at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:63)
at play.api.Play$.start(Play.scala:62)
at play.api.db.evolutions.EvolutionsPlugin.onStart(Evolutions.scala:432)
@6ele4bdao: Database 'default' is in inconsistent state!
....

To deploy i'm using the following using this procfile line:

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

Also as suggested i've used heroku pg:psql along with SELECT id, last_problem FROM play_evolutions; to find out the error and it says syntax error at or near "FALSE" but i don't see any false in my 1.sql file.

Anyone can give me a hand with this it's driving me crazy.


回答1:


There are 2 options:

  • Your evolution script is wrong, you should test it against a local postgresql database in your dev environment

  • You mention that you already did a deployment before. That means that evolution was run already. But you also mention that you are checking for errors inside 1.sql. If you already run evolutions once, Play would expect the new scripts to be in 2.sql. This may be a reason you are getting the exception.

Another solution is to disable evolutions (set evolutionplugin=disabled in application.conf) and do the changes manually by connecting to the postgresql database via a client. It may mean extra work, but it is probably a safer alternative to avoid leaving the database in an unstable state. Sometimes, control is better than automatization.



来源:https://stackoverflow.com/questions/17271669/playframework-2-1-and-heroku-update-problems

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!