Permalink
Browse files

Fix mysql codegen numeric default

  • Loading branch information...
trevorsibanda committed Aug 1, 2016
1 parent 8dcb5e3 commit 2e323a9f173e544d469a0cf755e8b699ceac91fe
@@ -0,0 +1 @@
CREATE TABLE DEFAULT_NUMERIC( d0 decimal(13,2) NOT NULL DEFAULT '0.00',d1 decimal(13) NOT NULL DEFAULT 0.00, d3 INT NOT NULL DEFAULT '0.00' );
@@ -80,6 +80,17 @@ val SimpleA = CustomTyping.SimpleA
})
},
new UUIDConfig("CG10", StandardTestDBs.H2Mem, "H2Mem", Seq("/dbs/uuid-h2.sql")),
new Config("MySQL", StandardTestDBs.MySQL, "MySQL", Seq("/dbs/mysql.sql")){
override def testCode =
"""
| val entry = DefaultNumericRow(d0 = scala.math.BigDecimal(123.45), d1 = scala.math.BigDecimal(90), d3 = 0)
| DBIO.seq(
| schema.create,
| DefaultNumeric += entry,
| DefaultNumeric.result.head.map{ r => assertEquals(r , entry) }
| )
""".stripMargin
},
new Config("Postgres1", StandardTestDBs.Postgres, "Postgres", Nil) {
import tdb.profile.api._
class A(tag: Tag) extends Table[(Int, Array[Byte], Blob)](tag, "a") {
@@ -83,6 +83,7 @@ trait MySQLProfile extends JdbcProfile { profile =>
case (v,"String") => Some(Some(v))
case ("1","Boolean") => Some(Some(true))
case ("0","Boolean") => Some(Some(false))
case ( v , "scala.math.BigDecimal") => Some( Some( scala.math.BigDecimal(v) ) )
}.getOrElse{
val d = super.default
if(meta.nullable == Some(true) && d == None){

0 comments on commit 2e323a9

Please sign in to comment.