문제

I have the following class that represents a record in postgresql:

case class Action(id: Option[Int], EmailAct: String, carriedAt: Timestamp)

id is an auto-increment field and carriedAt defaults to CURRENT_TIMESTAMP. How do I tell Slick I only want to provide value for EmailAct and the rest should be defaults?

This does not quite work: Dbs.actionsLog += Action(null, "test", null) - id gets auto-incremented but carriedAt becomes empty, not default.

도움이 되었습니까?

해결책

insert into a query that selects what you want to update:

Dbs.actionsLog.map(_.EmailAct) += "test"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top