0
votes

I have to create a Composite Primary key. I have three columns of type string. I came across this solution

def a = Column[String]("a")
def b = Column[String]("b")
def c = Column[String]("c")

def pk = primaryKey("pk_notifications", (a,b,c))

But there is no primary key when i describe the table.

1

1 Answers

1
votes

using SqlType could be one of the options

def a = Column[String]("a", SqlType("varchar(50)"))
def b = Column[String]("b", SqlType("varchar(50)"))
def c = Column[String]("c", SqlType("varchar(50)"))

def pk = primaryKey("pk_notifications", (a,b,c))