title: In Play Framework 2.3, how do I configure and apply evolutions to the in-memory database?
body: <p>With my Play 2.3.8/Slick 2.1 app, I'm trying to figure out how to set up multiple databases in my application.conf (MySQL and an in-memory database in MySQL mode), with one being automatically used for testing.  I think I got close, but it gives me this error:</p>
  
  <pre><code> InconsistentDatabase: : Database 'test' is in an inconsistent state![An evolution has not been applied properly. Please check the problem and resolve it manually before marking it as resolved.]  (Evolutions.scala:196)
  </code></pre>
  
  <p>I see a lot of related questions/documentation out there, but it either is out of date, or not exactly matching what I'm trying to do.</p>
  
  <p>Here's what I have in my application.conf</p>
  
  <pre><code>db.default.driver="com.mysql.jdbc.Driver"
  db.default.url="jdbc:mysql://localhost/maindb"
  db.default.user="admin"
  db.default.password="test"
  
  applyEvolutions.default=true
  
  db.test.driver=org.h2.Driver
  db.test.url="jdbc:h2:mem:play;MODE=MYSQL"
  db.test.user=sa
  db.test.password=""
  
  applyEvolutions.test=true
  
  slick.default= "models.database.*"
  slick.test= "models.database.*"
  </code></pre>
  
  <p>I realized, for this to work, I probably need to duplicate my evolution scripts into a conf/evolutions/test directory, so I did that.  I also wonder if I can just symlink it, to avoid needing to maintain two copies.</p>
  
  <p>Here's one of my Spec2 tests:</p>
  
  <pre><code>import org.specs2.mutable._
  import org.specs2.runner._
  import org.junit.runner._
  import play.api.test._
  import play.api.test.Helpers._
  import org.specs2.execute.{Result, AsResult}
  import play.api.db.slick._
  import play.api.db.slick.Config.driver.simple._
  import models.database.OwnersDatabase._
  
  abstract class WithDbData extends WithApplication(FakeApplication(additionalConfiguration = inMemoryDatabase("test"))) {
    override def around[T: AsResult](callback: =&gt; T): Result = super.around {
      prepareDbWithData()
      callback
    }
  
    def prepareDbWithData() = DB("test").withSession {
      implicit session =&gt; owners ++= TestData.inputData
    }
  }
  
  @RunWith(classOf[JUnitRunner])
  class OwnerControllerSpec extends Specification {
  
    "OwnerController" should {    
  
      "on owners return list of owners" in new WithDbData {
        val result = route(FakeRequest(GET, "/owners")).get
  
        status(result) must equalTo(OK)
        contentType(result) must beSome("application/json")
        contentAsJson(result) mustEqual TestData.expectedOwnersAll
      }
  
    }
  }
  </code></pre>
  
  <p>And here's the TestData class used to populate the table:</p>
  
  <pre><code>import models.Owner
  import play.api.libs.json._
  
  object TestData {
    val inputData = Seq(
      Owner("sam", "password", Some("Sam"), "test@example.com", None, "90210"),
      Owner("herb", "password", Some("Herb"), "test@example.com", None, "90210")
    )
  
    val expectedOwnersAll = Json.obj(
      "rows" -&gt; JsArray(Seq(
        Json.obj("username" -&gt; "sam", "password" -&gt; "password", "name" -&gt; "Sam", "email" -&gt; "test@example.com", "pic_id" -&gt; "", "zipcode" -&gt; "90210"),
        Json.obj("username" -&gt; "herb", "password" -&gt; "password", "name" -&gt; "Herb", "email" -&gt; "test@example.com", "pic_id" -&gt; "", "zipcode" -&gt; "90210")
      ))
    )
  }
  </code></pre>
  
  <p>What's going wrong?  And am I doing anything that's considered bad practice?</p>