mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
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:
parent
5197bf60d3
commit
c2c17f9b90
1 changed files with 7 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue