diff options
Diffstat (limited to 'lib/schema.php')
-rw-r--r-- | lib/schema.php | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/schema.php b/lib/schema.php index c9a0fb434..16fb50225 100644 --- a/lib/schema.php +++ b/lib/schema.php @@ -485,7 +485,7 @@ class Schema return $this->buildCreateTable($tableName, $def); } - $old = $this->filterDef($old); + //$old = $this->filterDef($old); $def = $this->filterDef($def); // @fixme check if not present @@ -749,15 +749,17 @@ class Schema function typeAndSize($column) { - $type = $this->mapType($column); + //$type = $this->mapType($column); + $type = $column['type']; + if (isset($column['size'])) { + $type = $column['size'] . $type; + } $lengths = array(); - if ($column['type'] == 'numeric') { - if (isset($column['precision'])) { - $lengths[] = $column['precision']; - if (isset($column['scale'])) { - $lengths[] = $column['scale']; - } + if (isset($column['precision'])) { + $lengths[] = $column['precision']; + if (isset($column['scale'])) { + $lengths[] = $column['scale']; } } else if (isset($column['length'])) { $lengths[] = $column['length']; @@ -778,6 +780,12 @@ class Schema */ protected function reverseMapType($type) { + $sizes = array('tiny', 'small', 'medium', 'big'); + foreach ($sizes as $prefix) { + if (substr($type, 0, strlen($prefix)) == $prefix) { + return array(substr($type, strlen($prefix)), $prefix); + } + } return array($type, null); } |