Using Auto Incrementing fields with PostgreSQL and Slick

前端 未结 7 1999
無奈伤痛
無奈伤痛 2020-12-30 00:43

How does one insert records into PostgreSQL using AutoInc keys with Slick mapped tables? If I use and Option for the id in my case class and set it to None, then PostgreSQL

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-30 01:27

    I've faced the same problem trying to make the computer-database sample from play-slick-3.0 when I changed the db to Postgres. What solved the problem was to change the id column (primary key) type to SERIAL in the evolution file /conf/evolutions/default/1.sql (originally was in BIGINT). Take a look at https://groups.google.com/forum/?fromgroups=#%21topic/scalaquery/OEOF8HNzn2U
    for the whole discussion. Cheers, ReneX

提交回复
热议问题