Permalink
Browse files

Fix BigDecimal Default value issue in Oracle

  • Loading branch information...
1 parent 51e14f2 commit 8a38fe7431b9bb46418da6fe7480f30aa2110482 @rbellamy rbellamy committed Sep 11, 2016
@@ -1,5 +1,6 @@
CREATE TABLE "PERSON"(
"ID" NUMBER(11,0) NOT NULL ENABLE,
"PERSON_TYPE" CHAR(1 BYTE) DEFAULT 'Y' NOT NULL ENABLE,
+ "AGE" NUMBER DEFAULT 0 NOT NULL ENABLE,
CONSTRAINT "PERSON_PK" PRIMARY KEY ("ID")
);
@@ -83,6 +83,14 @@ trait OracleProfile extends JdbcProfile {
case 101 => "Double"
case _ => super.tpe
}
+ override def default = meta.columnDef.map((_,tpe)).collect{
+ case (v, "scala.math.BigDecimal") => Some(Some(scala.math.BigDecimal(v.stripSuffix(" "))))
+ }.getOrElse{
+ val d = super.default
+ if(meta.nullable == Some(true) && d == None){
+ Some(None)
+ } else d
+ }
override def rawDefault = super.rawDefault.map(_.stripSuffix(" ")).map{
case "null" => "NULL"
case v => v

0 comments on commit 8a38fe7

Please sign in to comment.