Can anyone explain too me why I get the following compiler exception while declaring the TableQuery inside my trait.
class type required but T found
Isn't the T actually a Class type or am I mistaken?
trait TableModel[T <: Table[_]] {
val table: TableQuery[T] = TableQuery[T] <~~~~~~~~~~ class type required but T found
def exists(implicit session: Session): Boolean =
(!MTable.getTables(table.baseTableRow.tableName).list.isEmpty)
def schemaDescription: MySQLDriver.SchemaDescription = table.ddl
def create(implicit session: Session): Unit = schemaDescription.create
def drop(implicit session: Session): Unit = schemaDescription.drop
}
object UsersTable extends TableModel[Users] {}