Commit 4f7df7c1 authored by Marco Pivetta's avatar Marco Pivetta Committed by GitHub

Merge pull request #2612 from deeky666/DBAL-2555

[DBAL-2555] Fix date and datetimetz type mapping on Oracle
parents 292a6516 31fac117
...@@ -1126,7 +1126,7 @@ END;'; ...@@ -1126,7 +1126,7 @@ END;';
'nvarchar2' => 'string', 'nvarchar2' => 'string',
'char' => 'string', 'char' => 'string',
'nchar' => 'string', 'nchar' => 'string',
'date' => 'datetime', 'date' => 'date',
'timestamp' => 'datetime', 'timestamp' => 'datetime',
'timestamptz' => 'datetimetz', 'timestamptz' => 'datetimetz',
'float' => 'float', 'float' => 'float',
......
...@@ -102,7 +102,7 @@ class OracleSchemaManager extends AbstractSchemaManager ...@@ -102,7 +102,7 @@ class OracleSchemaManager extends AbstractSchemaManager
$dbType = strtolower($tableColumn['data_type']); $dbType = strtolower($tableColumn['data_type']);
if (strpos($dbType, "timestamp(") === 0) { if (strpos($dbType, "timestamp(") === 0) {
if (strpos($dbType, "WITH TIME ZONE")) { if (strpos($dbType, "with time zone")) {
$dbType = "timestamptz"; $dbType = "timestamptz";
} else { } else {
$dbType = "timestamp"; $dbType = "timestamp";
......
...@@ -231,4 +231,23 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase ...@@ -231,4 +231,23 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
$columns = $this->_sm->listTableColumns($table->getName(), $this->_conn->getUsername()); $columns = $this->_sm->listTableColumns($table->getName(), $this->_conn->getUsername());
$this->assertCount(7, $columns); $this->assertCount(7, $columns);
} }
/**
* @group DBAL-2555
*/
public function testListTableDateTypeColumns()
{
$table = new Table('tbl_date');
$table->addColumn('col_date', 'date');
$table->addColumn('col_datetime', 'datetime');
$table->addColumn('col_datetimetz', 'datetimetz');
$this->_sm->dropAndCreateTable($table);
$columns = $this->_sm->listTableColumns('tbl_date');
$this->assertSame('date', $columns['col_date']->getType()->getName());
$this->assertSame('datetime', $columns['col_datetime']->getType()->getName());
$this->assertSame('datetimetz', $columns['col_datetimetz']->getType()->getName());
}
} }
...@@ -412,6 +412,9 @@ class OraclePlatformTest extends AbstractPlatformTestCase ...@@ -412,6 +412,9 @@ class OraclePlatformTest extends AbstractPlatformTestCase
$this->assertEquals($expectedSql, $this->_platform->getAlterTableSQL($tableDiff)); $this->assertEquals($expectedSql, $this->_platform->getAlterTableSQL($tableDiff));
} }
/**
* @group DBAL-2555
*/
public function testInitializesDoctrineTypeMappings() public function testInitializesDoctrineTypeMappings()
{ {
$this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('long raw')); $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('long raw'));
...@@ -419,6 +422,9 @@ class OraclePlatformTest extends AbstractPlatformTestCase ...@@ -419,6 +422,9 @@ class OraclePlatformTest extends AbstractPlatformTestCase
$this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('raw')); $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('raw'));
$this->assertSame('binary', $this->_platform->getDoctrineTypeMapping('raw')); $this->assertSame('binary', $this->_platform->getDoctrineTypeMapping('raw'));
$this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('date'));
$this->assertSame('date', $this->_platform->getDoctrineTypeMapping('date'));
} }
protected function getBinaryMaxLength() protected function getBinaryMaxLength()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment