Question

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.

Was it helpful?

Solution

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

Dbs.actionsLog.map(_.EmailAct) += "test"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top