diff --git a/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php b/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php index e84b0a551f8..c717b471a7e 100644 --- a/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php @@ -128,7 +128,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) } } - $unsigned = $fixed = null; + $unsigned = $fixed = $precision = $scale = null; if (! isset($tableColumn['column_name'])) { $tableColumn['column_name'] = ''; @@ -146,8 +146,13 @@ protected function _getPortableTableColumnDefinition($tableColumn) $tableColumn['data_default'] = trim($tableColumn['data_default'], "'"); } - $precision = null; - $scale = null; + if ($tableColumn['data_precision'] !== null) { + $precision = (int) $tableColumn['data_precision']; + } + + if ($tableColumn['data_scale'] !== null) { + $scale = (int) $tableColumn['data_scale']; + } $type = $this->_platform->getDoctrineTypeMapping($dbType); $type = $this->extractDoctrineTypeFromComment($tableColumn['comments'], $type); @@ -155,23 +160,16 @@ protected function _getPortableTableColumnDefinition($tableColumn) switch ($dbType) { case 'number': - if ($tableColumn['data_precision'] === 20 && $tableColumn['data_scale'] === 0) { - $precision = 20; - $scale = 0; - $type = 'bigint'; - } elseif ($tableColumn['data_precision'] === 5 && $tableColumn['data_scale'] === 0) { - $type = 'smallint'; - $precision = 5; - $scale = 0; - } elseif ($tableColumn['data_precision'] === 1 && $tableColumn['data_scale'] === 0) { - $precision = 1; - $scale = 0; - $type = 'boolean'; + if ($precision === 20 && $scale === 0) { + $type = 'bigint'; + } elseif ($precision === 5 && $scale === 0) { + $type = 'smallint'; + } elseif ($precision === 1 && $scale === 0) { + $type = 'boolean'; } elseif ($tableColumn['data_scale'] > 0) { - $precision = $tableColumn['data_precision']; - $scale = $tableColumn['data_scale']; - $type = 'decimal'; + $type = 'decimal'; } + $length = null; break; case 'pls_integer':