title: Slick - how to split population of test data into separate file
body: <p>I have a working bit of code that generates my schema in slick</p>
  
  <pre><code>import scala.slick.driver.PostgresDriver.simple._
  import scala.slick.jdbc.{GetResult, StaticQuery =&gt; Q}
  
  Database.forURL("jdbc:postgresql://localhost:5432/gopher_dev",
    driver = "org.postgresql.Driver",
    user = "unodishuser",
    password = "unodishpass"
  ) withSession {
    implicit session =&gt;
  
      //drop and recreate public schema
      Q.updateNA("drop schema public cascade").execute
      Q.updateNA("create schema public").execute
  
      import Tables._
      //Make the tables
      (users.ddl ++ sessionData.ddl).create
  
      users ++= Seq(
        (1, "Ben", "ben@website.com", "secretpassword")
      )
  }
  </code></pre>
  
  <p>This piece which inserts an example user</p>
  
  <pre><code>users ++= Seq(
    (1, "Ben", "ben@website.com", "secretpassword")
  )
  </code></pre>
  
  <p>Works great for one row but I'd like to have a file with a dozen sample rows for each table (about 10 tables in total).  I can keep adding lines like this to my withSession block but as I am new to scala I confused as to how I could break this logic into a seperate piece of code/source file.  </p>
  
  <p>I tried making an object in another file called "TestDataBuilder"</p>
  
  <pre><code>object TestDataBuilder {
  
    import Tables._
    import scala.slick.driver.PostgresDriver.simple._
  
    users ++= Seq(
      (1, "Ben St. Pierre", "benstpierre@gmail.com", "secretpassword")
    )
  }
  </code></pre>
  
  <p>Then just called TestDataBuilder inside my withSession block like so:</p>
  
  <pre><code>import scala.slick.driver.PostgresDriver.simple._
  import scala.slick.jdbc.{GetResult, StaticQuery =&gt; Q}
  
  Database.forURL("jdbc:postgresql://localhost:5432/gopher_dev",
    driver = "org.postgresql.Driver",
    user = "unodishuser",
    password = "unodishpass"
  ) withSession {
    implicit session =&gt;
  
    //drop and recreate public schema
    Q.updateNA("drop schema public cascade").execute
    Q.updateNA("create schema public").execute
  
    import Tables._
    //Make the tables
    (users.ddl ++ sessionData.ddl).create
  
    TestDataBuilder
  }
  </code></pre>
  
  <p>Then I get this error:</p>
  
  <pre><code>[error] /usr/local/code/gofur/src/main/scala/com/lightningstrikesolutions/scala/db/TestDataBuilder.scala:11: could not find implicit value for parameter session: scala.slick.jdbc.JdbcBackend#SessionDef
  [error]   users ++= Seq(
  [error]         ^
  [error] one error found
  [error] (compile:compile) Compilation failed
  [error] Total time: 3 s, completed 13-Aug-2014 6:11:17 PM
  </code></pre>
  
  <p>Any idea how to fix this?</p>