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.

Était-ce utile?

La solution

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

Dbs.actionsLog.map(_.EmailAct) += "test"
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top