Open nemoo opened 2 years ago
ok, got it to compile by extending both.
import com.github.takezoe.slick.blocking.BlockingJdbcProfile
import com.github.tminglei.slickpg._
trait MyPostgresDriver extends ExPostgresProfile with BlockingJdbcProfile with PgDate2Support {
override val api = new API with DateTimeImplicits {}
}
object MyPostgresDriver extends MyPostgresDriver
and then using it like this:
import util.MyPostgresDriver.blockingApi._
My simple test case for the use of OffsetDateTime ( https://github.com/nemoo/play-slick-synchronous-example/blob/slick-pg/test/models/ModelScalaTestSpec.scala#L55 )
"An timestamp " should {
"be persisted correctly" in {
db.withSession { implicit session =>
val projectId = projectRepo.create("A")
val timestamp = OffsetDateTime.now()
val taskId = taskRepo.insert(Task(0, "blue", TaskStatus.ready, projectId, timestamp))
taskRepo.findById(taskId).lastModification mustBe timestamp
}
}
}
is still failing with:
- should be persisted correctly *** FAILED ***
[info] org.postgresql.util.PSQLException: ERROR: column "last_modification" is of type timestamp with time zone but expression is of type character varying
[info] Hint: You will need to rewrite or cast the expression.
[info] Position: 87
Where could I look for the error?
I want to use slick-pg with the great https://github.com/gitbucket/blocking-slick
It provides its own api and is used like this: import com.github.takezoe.slick.blocking.BlockingPostgresDriver.blockingApi._
I am strugling to combine the slick-pg with blocking-slick. My first naive approach looks like this:
This fails with
Illegal inheritance, self-type MyPostgresDriver does not conform to PgDate2Support with PostgresProfile
. I created feature branch for this experiment: https://github.com/nemoo/play-slick-synchronous-example/blob/slick-pg/app/util/MyPostgresDriver.scalaIs there a way to use slick-pg with external Profiles, like the one mentioned above?