0

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.

Dee_wab
  • 1,171
  • 1
  • 10
  • 23
Mahesh Chand
  • 3,158
  • 19
  • 37

1 Answers1

1

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))
shubham verma
  • 40
  • 1
  • 6