Skip to content

Commit

Permalink
Changed the default empty value when create columns.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed May 22, 2011
1 parent c602fc8 commit 375f86d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/Cake/Model/Datasource/Database/Mssql.php
Expand Up @@ -636,7 +636,11 @@ public function insertMulti($table, $fields, $values) {
function buildColumn($column) {
$result = preg_replace('/(int|integer)\([0-9]+\)/i', '$1', parent::buildColumn($column));
if (strpos($result, 'DEFAULT NULL') !== false) {
$result = str_replace('DEFAULT NULL', 'NULL', $result);
if (isset($column['default']) && $column['default'] === '') {
$result = str_replace('DEFAULT NULL', "DEFAULT ''", $result);
} else {
$result = str_replace('DEFAULT NULL', 'NULL', $result);
}
} else if (array_keys($column) == array('type', 'name')) {
$result .= ' NULL';
}
Expand Down

0 comments on commit 375f86d

Please sign in to comment.