Felix
Felix

Reputation: 5629

slick getting autoincrement id

is there a way to get right after inserting data via slick the autoincrement ID of this dataset?

val result: Future[Option[ProcessTemplatesModel]] = db.run(p).map(id => {
  Some(process)
})

Thanks

Upvotes: 0

Views: 154

Answers (1)

Denis Denisov
Denis Denisov

Reputation: 126

To get autoincrement id after insertion, you can use the following code from the slick documentation

val userId = (users returning users.map(_.id)) += User(None, "Stefan", "Zeiger")

Upvotes: 1

Related Questions