Skip to content
Snippets Groups Projects
Commit 517c6246 authored by Fabian Franz's avatar Fabian Franz
Browse files

Issue #3280572 by Fabianx: User proper types

parent 7d90aed9
No related branches found
No related tags found
No related merge requests found
......@@ -300,13 +300,18 @@ class Schema extends DatabaseSchema {
unset($spec['not null']);
}
if ($spec['oracle_type'] == 'varchar2') {
if ($spec['oracle_type'] == 'VARCHAR2') {
$sql .= '(' . (!empty($spec['length']) ? $spec['length'] : ORACLE_MAX_VARCHAR2_LENGTH) . ' CHAR)';
}
elseif (!empty($spec['length'])) {
$sql .= '(' . $spec['length'] . ')';
}
elseif (isset($spec['precision']) && isset($spec['scale'])) {
if ($spec['oracle_type'] == 'DOUBLE PRECISION' || $spec['oracle_type'] == 'FLOAT') {
// For double and floats and precision and scale only NUMBER is supported.
// @todo Check performance at some point.
$sql = $oname . ' NUMBER';
}
$sql .= '(' . $spec['precision'] . ', ' . $spec['scale'] . ')';
}
......@@ -333,47 +338,48 @@ class Schema extends DatabaseSchema {
// Put :normal last so it gets preserved by array_flip. This makes
// it much easier for modules (such as schema.module) to map
// database types back into schema types.
$map = array(
'varchar_ascii:normal' => 'varchar2',
static $map = [
'varchar_ascii:normal' => 'VARCHAR2',
'varchar:normal' => 'varchar2',
'char:normal' => 'char',
'varchar:normal' => 'VARCHAR2',
'char:normal' => 'CHAR',
'text:tiny' => 'varchar2',
'text:small' => 'varchar2',
'text:medium' => 'varchar2',
'text:big' => 'varchar2',
'text:normal' => 'varchar2',
'text:tiny' => 'VARCHAR2',
'text:small' => 'VARCHAR2',
'text:medium' => 'CLOB',
'text:big' => 'CLOB',
'text:normal' => 'CLOB',
'int:tiny' => 'number',
'int:small' => 'number',
'int:medium' => 'number',
'int:big' => 'number',
'int:normal' => 'number',
'int:tiny' => 'NUMBER',
'int:small' => 'NUMBER',
'int:medium' => 'NUMBER',
'int:big' => 'NUMBER',
'int:normal' => 'NUMBER',
'float:tiny' => 'number',
'float:small' => 'number',
'float:medium' => 'number',
'float:big' => 'number',
'float:normal' => 'number',
'float:tiny' => 'FLOAT',
'float:small' => 'FLOAT',
'float:medium' => 'FLOAT',
'float:big' => 'DOUBLE PRECISION',
'float:normal' => 'FLOAT',
'numeric:normal' => 'number',
'numeric:normal' => 'DOUBLE PRECISION',
'blob:big' => 'varchar2',
'blob:normal' => 'varchar2',
'blob:big' => 'BLOB',
'blob:normal' => 'BLOB',
// @TODO Recheck this.
'date:normal' => 'date',
'datetime:normal' => 'timestamp with local time zone',
'timestamp:normal' => 'timestamp',
'time:normal' => 'timestamp',
'serial:tiny' => 'number',
'serial:small' => 'number',
'serial:medium' => 'number',
'serial:big' => 'number',
'serial:normal' => 'number',
);
'serial:tiny' => 'NUMBER',
'serial:small' => 'NUMBER',
'serial:medium' => 'NUMBER',
'serial:big' => 'NUMBER',
'serial:normal' => 'NUMBER',
];
return $map;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment