Skip to content
Permalink
Browse files
add text type to postgres column builder
  • Loading branch information
stewSquared committed Mar 23, 2016
1 parent 408f2e5 commit 04e67f6e33884922f44a7a9711c8602d6c7b69c1
Showing 1 changed file with 2 additions and 0 deletions.
@@ -64,11 +64,13 @@ trait PostgresProfile extends JdbcProfile {
}
override def createColumnBuilder(tableBuilder: TableBuilder, meta: MColumn): ColumnBuilder = new ColumnBuilder(tableBuilder, meta) {
val VarCharPattern = "^'(.*)'::character varying$".r
val TextPattern = "^'(.*)'::text".r
val IntPattern = "^\\((-?[0-9]*)\\)$".r
override def default = meta.columnDef.map((_,tpe)).collect{
case ("true","Boolean") => Some(Some(true))
case ("false","Boolean") => Some(Some(false))
case (VarCharPattern(str),"String") => Some(Some(str))
case (TextPattern(str),"String") => Some(Some(str))
case (IntPattern(v),"Int") => Some(Some(v.toInt))
case (IntPattern(v),"Long") => Some(Some(v.toLong))
case ("NULL::character varying","String") => Some(None)

0 comments on commit 04e67f6

Please sign in to comment.