Skip to content

Commit 375f86d

Browse files
committed
Changed the default empty value when create columns.
1 parent c602fc8 commit 375f86d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/Cake/Model/Datasource/Database/Mssql.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,11 @@ public function insertMulti($table, $fields, $values) {
636636
function buildColumn($column) {
637637
$result = preg_replace('/(int|integer)\([0-9]+\)/i', '$1', parent::buildColumn($column));
638638
if (strpos($result, 'DEFAULT NULL') !== false) {
639-
$result = str_replace('DEFAULT NULL', 'NULL', $result);
639+
if (isset($column['default']) && $column['default'] === '') {
640+
$result = str_replace('DEFAULT NULL', "DEFAULT ''", $result);
641+
} else {
642+
$result = str_replace('DEFAULT NULL', 'NULL', $result);
643+
}
640644
} else if (array_keys($column) == array('type', 'name')) {
641645
$result .= ' NULL';
642646
}

0 commit comments

Comments
 (0)