summaryrefslogtreecommitdiff
path: root/lib/schema.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-10-15 16:32:37 -0700
committerBrion Vibber <brion@pobox.com>2010-10-15 16:32:37 -0700
commiteb93bdbb038e8e22ee2bbcb84dbe3967672c48cf (patch)
treefaac234d07846f0881a2fecc2c9ef673cdbf4715 /lib/schema.php
parentfa50ab2a947219bbf9ef5069c8c40d6c7b02406f (diff)
some more tweaking to do the mappings during filterDef; not totally sure I like it
Diffstat (limited to 'lib/schema.php')
-rw-r--r--lib/schema.php24
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);
}