1

Im using play-slick 3.0.3 I have such column:

val someDate = column[Option[LocalDateTime]]("some_date", O.Default(None))

and in code I want to do:

table.someDate.isEmpty

but Ive got errors that isEmpty does not exists.. for example for Option[Int] it works fine..

Im having this problem after migration from 1.1.1 :)

or in other places in code:

value value is not a member of java.time.LocalDateTime

any help appreciated thanks!

FrancMo
  • 2,459
  • 2
  • 19
  • 39

1 Answers1

0

Not a lot of info, but how it could be (example for slick 3.1, think should be similar for 3.0):

case class RowClass(id: Option[Int],
                    someDate: Option[LocalDateTime])

case class TableClass(tag: Tag)
  extends Table[RowClass](tag, "companies") {
  val id = column[Int]("id", O.PrimaryKey, O.AutoInc)
  val someDate = column[Option[LocalDateTime]]("some_date", O.Default(None))

  def * = (id.?, someDate) <> ( RowClass.tupled, RowClass.unapply )
}
val query = TableQuery[TableClass]
val q: Query[TableClass, RowClass, Seq] = 
  query.filter(_.someDate.isEmpty)

and than you can get result as

val result: Future[Seq[RowClass]] =
  db.run(q.result)

Please note, that slick introduced huge amount of difference even between versions 2.1 and 3.0, from my point of view it is hard to migrate. And will be harder to migrate from 1.1.1

Evgeny
  • 1,760
  • 10
  • 11
  • thanks for you comment. I did not mentioned earlier that it is play project using play-slick lib :( – FrancMo Mar 12 '18 at 08:01
  • ok I see, I had issue in using slick-pg lib, missing some stuff, in old code there was manual mappings, nvm ;) – FrancMo Mar 12 '18 at 09:15