エラー状況
slickを利用してデータを反映させたいのですが、evolutionが成功せず、同じ画面をぐるぐる回ってしまっています。
発生している問題・エラーメッセージ
該当のソースコード
build.sbt
Scala
1name := """play-scala-myapp2""" 2organization := "com.play" 3 4version := "1.0-SNAPSHOT" 5 6lazy val root = (project in file(".")).enablePlugins(PlayScala) 7 8scalaVersion := "2.12.8" 9 10libraryDependencies += guice 11libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % Test 12libraryDependencies += "com.h2database" % "h2" % "1.4.197" 13libraryDependencies += "com.typesafe.play" %% "play-slick" % "3.0.3" 14libraryDependencies += "com.typesafe.play" %% "play-slick-evolutions" % "3.0.3" 15
application.conf
Scala
1# https://www.playframework.com/documentation/latest/Configuration 2slick.dbs.default.driver="slick.driver.H2Driver$" 3slick.dbs.default.db.profile="org.h2.Driver" 4slick.dbs.default.db.url="jdbc:h2:mem:mydatabase;DB_CLOSE_DELAY=-1"
リポジトリ
Scala
1package models 2 3 4import javax.inject.{ Inject, Singleton } 5import play.api.db.slick.DatabaseConfigProvider 6import slick.jdbc.JdbcProfile 7 8 9import scala.concurrent.{ Future, ExecutionContext } 10 11 12@Singleton 13class PersonRepository @Inject() 14(dbConfigProvider: DatabaseConfigProvider) 15 (implicit ec: ExecutionContext) { 16 17 18 private val dbConfig = dbConfigProvider.get[JdbcProfile] 19 20 21 import dbConfig._ 22 import profile.api._ 23 24 25 private class PeopleTable(tag: Tag) 26 extends Table[Person](tag, "people") { 27 def id = column[Int]("id", O.PrimaryKey, O.AutoInc) 28 def name = column[String]("name") 29 def mail = column[String]("mail") 30 def tel = column[String]("tel") 31 32 33 def * = (id, name, mail, tel) <> 34 ((Person.apply _).tupled, Person.unapply) 35 } 36 37 38 private val people = TableQuery[PeopleTable] 39 40 def list(): Future[Seq[Person]] = db.run { 41 people.result 42 } 43}
初めての分野なのでこのエラーの原因が予想できませんでした。
よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/02/27 04:40
2019/02/27 10:10
2019/02/28 02:40 編集
2019/02/28 07:57
2019/02/28 09:24