diff --git a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php index 4bd948fd1..91bd60354 100644 --- a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php @@ -279,7 +279,7 @@ class MySqlPlatform extends AbstractPlatform */ public function getDateTimeTypeDeclarationSql(array $fieldDeclaration) { - if (isset($fieldDeclaration['version'])) { + if (isset($fieldDeclaration['version']) && $fieldDeclaration['version'] == true) { return 'TIMESTAMP'; } else { return 'DATETIME'; diff --git a/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php index 596136035..7796fd0a5 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php @@ -195,4 +195,14 @@ class MySqlPlatformTest extends \Doctrine\Tests\DbalTestCase $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10); $this->assertEquals('SELECT * FROM user LIMIT 10', $sql); } + + /** + * @group DDC-118 + */ + public function testGetDateTimeTypeDeclarationSql() + { + $this->assertEquals("DATETIME", $this->_platform->getDateTimeTypeDeclarationSql(array('version' => false))); + $this->assertEquals("TIMESTAMP", $this->_platform->getDateTimeTypeDeclarationSql(array('version' => true))); + $this->assertEquals("DATETIME", $this->_platform->getDateTimeTypeDeclarationSql(array())); + } } \ No newline at end of file