Commit 8a13144a authored by Marco Pivetta's avatar Marco Pivetta

Merge branch 'fix/#2555-#2612-fix-date-and-datetimetz-type-mapping-on-oracledb' into 2.5

Backport #2555 to 2.5
Backport #2612 to 2.5
parents 94016b98 226d9fed
...@@ -1123,7 +1123,7 @@ LEFT JOIN user_cons_columns r_cols ...@@ -1123,7 +1123,7 @@ LEFT JOIN user_cons_columns r_cols
'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";
......
...@@ -233,4 +233,23 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase ...@@ -233,4 +233,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());
}
} }
...@@ -414,6 +414,9 @@ class OraclePlatformTest extends AbstractPlatformTestCase ...@@ -414,6 +414,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'));
...@@ -421,6 +424,9 @@ class OraclePlatformTest extends AbstractPlatformTestCase ...@@ -421,6 +424,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