I am migrating from slick-extenstions to slick 3.2.0
import slick.lifted.{ProvenShape, Tag}
import slick.model.Table
class Admin(tag : Tag) extends Table[(Long, Long)](tag, "NT_CV_ADMIN_SHORT") {
def parentId = column[Long]("PARENT_ID")
def maxAdminShort = column[Long]("MAX_ADMIN_SHORT")
override def * : ProvenShape[(Long, Long)] = (parentId, maxAdminShort)
}
For the above declaration of table I am getting following error - error: slick.model.Table does not take type parameters
Here is the dependency I used -
<dependency>
<groupId>com.typesafe.slick</groupId>
<artifactId>slick_2.12</artifactId>
<version>3.2.0</version>
</dependency>
I don't understand what I am missing. I saw slick3.2.0 manual - https://scala-slick.org/doc/3.2.0/gettingstarted.html, that's how I have created the table. I don't know if I am missing something?
You've imported the wrong Table
.
Slick is kinda confusing in that it wants you to get most of your imports from a "driver" class. The getting started guide you linked tells you to add these imports:
import slick.jdbc.H2Profile.api._
import scala.concurrent.ExecutionContext.Implicits.global
If you were using a different database e.g. MySQL you would import slick.jdbc.MySQLProfile.api._
instead.
Here are the scaladocs for the api
type: https://scala-slick.org/doc/3.2.0/api/index.html#slick.jdbc.JdbcProfile$API - as you can see from that page, the api
provides a whole bunch of type aliases and values. The Table
you want is the one in there.