I have the following column in my postgres table:
ALTER TABLE my_table
ALTER COLUMN test_field TYPE text ARRAY USING test_field::text ARRAY
When I regenerate the Slick schema directly from my postgres table, I have the following"
* @param test_field Database column test_field SqlType(_text), Length(2147483647,false), Default(None) */
case class MyTable(id: java.util.UUID, created: Option[java.sql.Timestamp] = None, test_field: Option[String] = None)
/** GetResult implicit for fetching MyTable objects using plain SQL queries */
implicit def GetResultTable(implicit e0: GR[java.util.UUID], e1: GR[Option[java.sql.Timestamp]], e2: GR[String] = GR{
prs => import prs._
MyTable(<<[java.util.UUID], <<?[java.sql.Timestamp],<<?[String])
}
I am not sure as why the field is not recognised as Option[Array[String]]
, Where did I go wrong?
Thanks
I employed slick-pg
and created my own MyPostgresProfile
as detailed in the project's README. It turned out that there are issues with Slick dealing with text[]
in Postgres and despite slick-pg
does support Arrays:
[https://github.com/tminglei/slick-pg/tree/master/core/src/main/scala/com/github/tminglei/slickpg/array][1]
When generating the table, such array was actually seen as a Seq
I ended up changing the data type in Postgres from Array to jsonb and it is deal with beautifully by the plugin using JValue
.