Вопрос

I have the problem that the play database evolution on the deployed server is in inconsistent state again and again. I don't understand what's the problem.

  • All the tests work fine (in memory)
  • I can start the application with run (in memory)
  • I delete the evolution sql-script and let it generate newly (by clicking in the browsers evolution trigger)
  • I switch the necessary properties in the conf file for the mysql access
  • I start the build with play clean compile stage
  • I drop and create the mysql database
  • then I start the application with -DapplyEvolutions.default=true

I to often get this error:

[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)

It works suddenly after playing around with the whole process.

Это было полезно?

Решение

You should generate your evolution script after you switched your configuration to mysql.

The generated script is RDBMS-dependent. It needs to be created with the correct database engine before you launch play clean compile stage

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top