Commit 6d36298d authored by Benjamin Eberlei's avatar Benjamin Eberlei

DBAL-70 - MySQL and DB2 did handle floats as Doctrine decimal.

parent 8dcdf5a9
...@@ -37,8 +37,8 @@ class DB2Platform extends AbstractPlatform ...@@ -37,8 +37,8 @@ class DB2Platform extends AbstractPlatform
'character' => 'string', 'character' => 'string',
'clob' => 'text', 'clob' => 'text',
'decimal' => 'decimal', 'decimal' => 'decimal',
'double' => 'decimal', 'double' => 'float',
'real' => 'decimal', 'real' => 'float',
'timestamp' => 'datetime', 'timestamp' => 'datetime',
); );
} }
......
...@@ -591,9 +591,9 @@ class MySqlPlatform extends AbstractPlatform ...@@ -591,9 +591,9 @@ class MySqlPlatform extends AbstractPlatform
'datetime' => 'datetime', 'datetime' => 'datetime',
'timestamp' => 'datetime', 'timestamp' => 'datetime',
'time' => 'time', 'time' => 'time',
'float' => 'decimal', 'float' => 'float',
'double' => 'decimal', 'double' => 'float',
'real' => 'decimal', 'real' => 'float',
'decimal' => 'decimal', 'decimal' => 'decimal',
'numeric' => 'decimal', 'numeric' => 'decimal',
'year' => 'date', 'year' => 'date',
......
...@@ -46,7 +46,7 @@ class Column extends AbstractAsset ...@@ -46,7 +46,7 @@ class Column extends AbstractAsset
/** /**
* @var int * @var int
*/ */
protected $_precision = 0; protected $_precision = 10;
/** /**
* @var int * @var int
......
...@@ -93,7 +93,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest ...@@ -93,7 +93,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$this->assertTrue( $foundTable , "The 'list_tables_test' table has to be found."); $this->assertTrue( $foundTable , "The 'list_tables_test' table has to be found.");
} }
public function testListTableColumns() public function createListTableColumns()
{ {
$table = new \Doctrine\DBAL\Schema\Table('list_table_columns'); $table = new \Doctrine\DBAL\Schema\Table('list_table_columns');
$table->addColumn('id', 'integer', array('notnull' => true)); $table->addColumn('id', 'integer', array('notnull' => true));
...@@ -104,6 +104,13 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest ...@@ -104,6 +104,13 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$table->addColumn('baz2', 'time'); $table->addColumn('baz2', 'time');
$table->addColumn('baz3', 'date'); $table->addColumn('baz3', 'date');
return $table;
}
public function testListTableColumns()
{
$table = $this->createListTableColumns();
$this->_sm->dropAndCreateTable($table); $this->_sm->dropAndCreateTable($table);
$columns = $this->_sm->listTableColumns('list_table_columns'); $columns = $this->_sm->listTableColumns('list_table_columns');
...@@ -163,6 +170,21 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest ...@@ -163,6 +170,21 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$this->assertType('array', $columns['baz3']->getPlatformOptions()); $this->assertType('array', $columns['baz3']->getPlatformOptions());
} }
public function testDiffListTableColumns()
{
if ($this->_sm->getDatabasePlatform()->getName() == 'oracle') {
$this->markTestSkipped('Does not work with Oracle, since it cannot detect DateTime, Date and Time differenecs (at the moment).');
}
$offlineTable = $this->createListTableColumns();
$onlineTable = $this->_sm->listTableDetails('list_table_columns');
$comparator = new \Doctrine\DBAL\Schema\Comparator();
$diff = $comparator->diffTable($offlineTable, $onlineTable);
$this->assertFalse($diff, "No differences should be detected with the offline vs online schema.");
}
public function testListTableIndexes() public function testListTableIndexes()
{ {
$table = $this->getTestTable('list_table_indexes_test'); $table = $this->getTestTable('list_table_indexes_test');
......
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