I have a basic development database configured like this:
# Default database configuration using H2 database engine in an in-memory mode
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play;DB_CLOSE_DELAY=-1;MODE=MYSQL;DATABASE_TO_UPPER=FALSE"
I added a script to create the tables from the database in conf/evolutions/default/1.sql
When starting the application with sbt run
and going to any page, Play asks me to apply the script 1.sql
. After pressing the button, I get the following error:
JdbcSQLException: Table "play_evolutions" not found; SQL statement: update play_evolutions set last_problem = ? where id = ? [42102-192]`en`
Shouldn't the play framework already create this?
//project/plugins.sbt
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.10")
//build.sbt
lazy val root =
(project in file("."))
.enablePlugins(PlayScala)
scalaVersion := "2.11.8"
libraryDependencies += jdbc
libraryDependencies += evolutions
I have checked the 1.sql in evolutions.default package, and there might be something that causes the table not found
thing.
USE mydb;
With this statement, your "working schema" is now jdbc:h2:mem:play/mydb.
However the play_evolutions table is created just under the root jdbc:h2:mem:play, meaning nothing under jdbc:h2:mem:play/mydb called play_evolutions, which causes the ERROR.
The solution is easy:
remove USE mydb;
Hope it helps.