Scala & Play! & Slick & PostgreSQL auto increment Scala & Play! & Slick & PostgreSQL auto increment postgresql postgresql

Scala & Play! & Slick & PostgreSQL auto increment


Here is a suggestion, rewrite your autoInc and add methods like this:

def autoInc = name ~ price ~ description returning iddef add(product: Product)(implicit s:Session): Long = {    Products.autoInc.insert(p.name, p.price, p.description)}

Some databases own't allow you to insert null in the auto increment column. Maybe it's the Postgres case.