0
votes

I have a schema definition as follows: package model

import java.sql.Timestamp

import play.api.libs.json.{Format, Json}
import slick.driver.PostgresDriver.api._
import slick.lifted.Tag

case class ApiKey(id: Option[Int] = None, key: String, createdAt: Timestamp)

object ApiKeys {

  implicit lazy val apiKeyFormat: Format[ApiKey] = Json.format[ApiKey]

}

class ApiKeys(tag: Tag) extends Table[ApiKey](tag, "api_key"){
...
  def createdAt = column[Timestamp]("createdAt", O.NotNull)
...
}

the compiler complains that Cannot resolve symbol NotNull even though the docs states that this option should be available: http://slick.lightbend.com/doc/3.1.1/schemas.html

Even if I look into the source there is not such thing. What am I missing in the docs?

1

1 Answers

4
votes

O.NotNull is removed in the latest version of the slick. By default everything is not null in slick when column is declared like this column[A]. To make the column nullable you have to declare it as column[Option[A]]