Permalink
Browse files

Changed the default empty value when create columns.

  • Loading branch information...
1 parent c602fc8 commit 375f86d2a6ee16ce987998c75db4b3fc4f6abf8f @jrbasso jrbasso committed May 22, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/Cake/Model/Datasource/Database/Mssql.php
View
6 lib/Cake/Model/Datasource/Database/Mssql.php
@@ -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';
}

0 comments on commit 375f86d

Please sign in to comment.