diff --git a/core/model/fieldtypes/Float.php b/core/model/fieldtypes/Float.php index c6035bd00..91f726f85 100644 --- a/core/model/fieldtypes/Float.php +++ b/core/model/fieldtypes/Float.php @@ -5,9 +5,15 @@ * @subpackage model */ class Float extends DBField { + + function __construct($name, $defaultVal = 0) { + $this->defaultVal = is_float($defaultVal) ? $defaultVal : (float)0; + + parent::__construct($name); + } function requireField() { - $parts=Array('datatype'=>'float', 'arrayValue'=>$this->arrayValue); + $parts=Array('datatype'=>'float', 'null'=>'not null', 'default'=>$this->defaultVal, 'arrayValue'=>$this->arrayValue); $values=Array('type'=>'float', 'parts'=>$parts); DB::requireField($this->tableName, $this->name, $values); }