Trying to insert the information into DB that looks like this:
(UUID, EnumType)
with following logic:
var t = TestTable.query.map(t=> (t.id, t.enumType)) ++= toAdd.map(idTest, enumTest)))
but compiler throws an error for TestTable.query.map(t=> (t.id, t.enumType)) it's interpriting it as type Iteratable[Nothing], am I missing something?
Test table looks like this:
object TestTable {
val query = TableQuery[TestTable]
}
class TestTable(tag: slick.lifted.Tag) extends Table[TestTable](tag, "test_table") {
val id = column[UUID]("id")
val enumType = column[EnumType]("enumType")
override val * = (id, testType) <> (
(TestTable.apply _).tupled,
TestTable.unapply
)
Suppose you have following data structure:
Define slick schema as following:
To map enum to SQL data type slick requires implicit MappedColumnType:
Now you can insert values into DB in this way: