Shurik Agulyansky Shurik Agulyansky - 5 months ago 48
Scala Question

Cannot resolve symbol NotNull with Slick 3.1.1

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:

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


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]]