Playframework 2.1和Heroku更新问题 [英] Playframework 2.1 and Heroku update problems

查看:118
本文介绍了Playframework 2.1和Heroku更新问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个play framework 2.1.0项目并将其部署在heroku上。上星期五我不得不改变数据模型来添加一些额外的字段。一旦我尝试部署更改,它给了我进化错误。

无法修复问题我已恢复更改并部署旧版本,但我仍然得到错误。



目前我得到的错误是这个

 数据库[默认]连接在jdbc:postgresql:... 
位置:27 [错误:0,SQLSTATE:42601]
错误:语法错误处于或接近FALSE
处。 api.db.evolutions.EvolutionsPlugin $$ anonfun $ onStart $ 1 $$ anonfun $ apply $ 1.apply $ mcV $ sp(Evolutions.scala:435)
糟糕,无法启动服务器。
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:数据库'默认'处于不一致的状态!
....

要部署我使用以下procfile行:

  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} 

同样如所暗示的,我使用了 heroku pg:psql 以及 SELECT id,last_problem FROM play_evolutions; 找出错误,并在FALSE处或附近说语法错误但我在1.sql文件中看不到任何错误。



任何人都可以为我伸出援手,这让我疯狂。

有2种选择:你的进化脚本是错误的,你应该在你的开发环境中对本地postgresql数据库进行测试。

你提到你之前已经做过部署。这意味着演变已经开始。但是你也提到你正在检查 1.sql 中的错误。如果你已经运行过一次,Play会希望新脚本位于 2.sql 中。这可能是您获得例外的原因。




另一个解决方案是禁用evolutions(set evolutionplugin = disabled in application.conf )并通过客户端连接到postgresql数据库来手动执行更改。这可能意味着额外的工作,但它可能是避免数据库处于不稳定状态的更安全选择。有时候,控制比自动化要好。

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.

解决方案

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.

这篇关于Playframework 2.1和Heroku更新问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆