I'm using Slick 3.1.1 and a case class to represent the mapping with an existing table and I'm trying to update a row. One way I found doing this is by specifying which fields to update like so:
val query = table.filter(_.id == id)
.map(r => (r.field1, r.field2))
.update(("value1", "value2"))
db.run(query)
The table has a few more fields. Now the problem is that the whole row comes into this method and some fields remain unchanged. I saw on a related question that in Slick 2.X the following was an option:
table.filter(_.id === id).update(row)
Trying the above however naturally produced a Cannot update identity column 'id'
error.
Is there a way I can do an update without having to specify specific fields whilst at the same time leaving out the id
?
Thanks!