"The database" default "is in an inconsistent state!" comes and goes

I had a problem that the evolution of the replay database on the deployed server is again and again in an inconsistent state. I do not understand what the problem is.

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

I 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 with the whole process.

+4
source share
1 answer

You must generate your evolution script after you switch your configuration to mysql.

The generated script is RDBMS-dependent. Before running play clean compile stage

You must create the correct database engine.
+1
source

Source: https://habr.com/ru/post/1490549/


All Articles