Is there a way I can neatly do an upsert operation in Slick? The following works but is too obscure/verbose and I need to explicitly state the fields that should be updated:
Apparently this is not (yet?) in Slick.
You might however try firstOption for something a bit more idiomatic:
val id = 1
val now = new Timestamp(System.currentTimeMillis)
val user = Users.filter(_.id is id)
user.firstOption match {
case Some((_, created, _)) => user.update((id, created, now))
case None => Users.insert((id, now, now))
}