“数据库'默认'处于不一致状态!”来来去去

时间:2013-07-09 18:46:17

标签: playframework playframework-2.1 playframework-evolutions

我遇到的问题是部署的服务器上的播放数据库演变一次又一次处于不一致状态。我不明白这是什么问题。

  • 所有测试都运行良好(在内存中)
  • 我可以使用run(在内存中)启动应用程序
  • 我删除了evolution sql-script并让它新生成(通过点击浏览器进化触发器)
  • 我在conf文件中切换必要的属性以进行mysql访问
  • 我使用play clean compile stage
  • 开始构建
  • 我删除并创建了mysql数据库
  • 然后我用-DapplyEvolutions.default = true
  • 启动应用程序

我经常会收到此错误:

[error] play - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sequence life_cycle_event_seq' at line 1 [ERROR:1064, SQLSTATE:42000]
Oops, cannot start the server.
@6epm5i5m6: Database 'default' is in inconsistent state!
    at play.api.db.evolutions.Evolutions$.checkEvolutionsState(Evolutions.scala:177)
    at play.api.db.evolutions.Evolutions$.applyScript(Evolutions.scala:275)
    at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1$$anonfun$apply$1.apply$mcV$sp(Evolutions.scala:446)
    at play.api.db.evolutions.EvolutionsPlugin.withLock(Evolutions.scala:483)
    at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.scala:439)
    at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.scala:437)
    at scala.collection.immutable.List.foreach(List.scala:309)
    at play.api.db.evolutions.EvolutionsPlugin.onStart(Evolutions.scala:437)
    at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:63)
    at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:63)
    at scala.collection.immutable.List.foreach(List.scala:309)
    at play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:63)
    at play.api.Play$$anonfun$start$1.apply(Play.scala:63)
    at play.api.Play$$anonfun$start$1.apply(Play.scala:63)
    at play.utils.Threads$.withContextClassLoader(Threads.scala:18)
    at play.api.Play$.start(Play.scala:62)
    at play.core.StaticApplication.<init>(ApplicationProvider.scala:54)
    at play.core.server.NettyServer$.createServer(NettyServer.scala:228)
    at play.core.server.NettyServer$$anonfun$main$5.apply(NettyServer.scala:259)
    at play.core.server.NettyServer$$anonfun$main$5.apply(NettyServer.scala:258)
    at scala.Option.map(Option.scala:145)
    at play.core.server.NettyServer$.main(NettyServer.scala:258)
    at play.core.server.NettyServer.main(NettyServer.scala)

在玩完整个过程后突然发挥作用。

1 个答案:

答案 0 :(得分:1)

您应该在之后生成演变脚本,将配置切换为mysql。

生成的脚本依赖于RDBMS。在启动play clean compile stage

之前,需要使用正确的数据库引擎创建它