Fixing MySQL schema generation for null columns

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4637 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2007-03-21 05:00:54 +00:00
parent 5197bf60d3
commit c2c17f9b90

View file

@ -527,9 +527,11 @@ class DboMysql extends DboSource {
$real = $this->columns[$type];
$out = $this->name($name) . ' ' . $real['name'];
if (isset($real['limit']) || isset($real['length'])) {
if (isset($col['length'])) {
$length = $col['length'];
if (isset($real['limit']) || isset($real['length']) || isset($column['limit']) || isset($column['length'])) {
if (isset($column['length'])) {
$length = $column['length'];
} elseif (isset($column['limit'])) {
$length = $column['limit'];
} elseif (isset($real['length'])) {
$length = $real['length'];
} else {
@ -546,6 +548,8 @@ class DboMysql extends DboSource {
$out .= ' DEFAULT NULL';
} elseif (isset($column['default']) && isset($column['null']) && $column['null'] == false) {
$out .= ' DEFAULT ' . $this->value($column['default'], $type) . ' NOT NULL';
} elseif (isset($column['null']) && $column['null'] == false) {
$out .= ' NOT NULL';
}
return $out;
}