문제

I having a table column holds auto increment value. I want to start incrementing from specified vlaue. How can i specify this functionality in slick ddl.

Code i am using for column of table creation in slick is :

def id = column[Long]("id", O.PrimaryKey, O.AutoInc, O.NotNull)

I have come across this article but didn't find exact solution.

create table "COCKTAIL" (
  "ID" BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 100000) NOT NULL PRIMARY KEY,
  "NAME" VARCHAR NOT NULL)

Can someone help me how to achieve this.

도움이 되었습니까?

해결책

What about O.Default(...)? Look at here: ColumnOption.

def id = column[Long]("id", O.PrimaryKey, O.AutoInc, O.NotNull,O.Default(100000))
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top