mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
ENHANCEMENT MSSQLDatabase::decimal() field type now accepts user defined default values if it's available
This commit is contained in:
parent
9c1bda45ff
commit
b8b85a12a2
@ -872,9 +872,16 @@ class MSSQLDatabase extends SS_Database {
|
||||
$precision = $values['precision'];
|
||||
}
|
||||
|
||||
if($asDbValue)
|
||||
return Array('data_type'=>'decimal', 'numeric_precision'=>'9,2');
|
||||
else return 'decimal(' . $precision . ') not null default 0';
|
||||
$defaultValue = '0';
|
||||
if(isset($values['default']) && is_numeric($values['default'])) {
|
||||
$defaultValue = $values['default'];
|
||||
}
|
||||
|
||||
if($asDbValue) {
|
||||
return array('data_type'=>'decimal', 'numeric_precision'=>'9,2');
|
||||
} else {
|
||||
return 'decimal(' . $precision . ') not null default ' . $defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user