1
0
mirror of synced 2024-12-13 14:56:01 +03:00

[2.0] Other fixes, removed E_FATAL of duplicate declaration and added test for Boolean type

This commit is contained in:
guilhermeblanco 2009-09-05 02:44:45 +00:00
parent 4d4374395b
commit 3ef0bf50e9
7 changed files with 22 additions and 27 deletions

View File

@ -325,14 +325,6 @@ class MsSqlPlatform extends AbstractPlatform
return 'SET TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSql($level); return 'SET TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSql($level);
} }
/**
* @override
*/
public function getBooleanTypeDeclarationSql(array $field)
{
return 'BIT';
}
/** /**
* @override * @override
*/ */
@ -374,7 +366,9 @@ class MsSqlPlatform extends AbstractPlatform
: ($length ? 'VARCHAR(' . $length . ')' : 'TEXT'); : ($length ? 'VARCHAR(' . $length . ')' : 'TEXT');
} }
/** @override */ /**
* @override
*/
protected function _getCommonIntegerTypeDeclarationSql(array $columnDef) protected function _getCommonIntegerTypeDeclarationSql(array $columnDef)
{ {
$autoinc = ''; $autoinc = '';

View File

@ -193,14 +193,6 @@ class OraclePlatform extends AbstractPlatform
return 'TIMESTAMP(0) WITH TIME ZONE'; return 'TIMESTAMP(0) WITH TIME ZONE';
} }
/**
* @override
*/
public function getBooleanTypeDeclarationSql(array $field)
{
return 'NUMBER(1)';
}
/** /**
* @override * @override
*/ */

View File

@ -712,14 +712,6 @@ class PostgreSqlPlatform extends AbstractPlatform
return 'DATE'; return 'DATE';
} }
/**
* @override
*/
public function getBooleanTypeDeclarationSql(array $field)
{
return 'BOOLEAN';
}
/** /**
* @override * @override
*/ */

View File

@ -6,6 +6,7 @@ use Doctrine\DBAL\Platforms;
class MockPlatform extends \Doctrine\DBAL\Platforms\AbstractPlatform class MockPlatform extends \Doctrine\DBAL\Platforms\AbstractPlatform
{ {
public function getBooleanTypeDeclarationSql(array $columnDef) {}
public function getIntegerTypeDeclarationSql(array $columnDef) {} public function getIntegerTypeDeclarationSql(array $columnDef) {}
public function getBigIntTypeDeclarationSql(array $columnDef) {} public function getBigIntTypeDeclarationSql(array $columnDef) {}
public function getSmallIntTypeDeclarationSql(array $columnDef) {} public function getSmallIntTypeDeclarationSql(array $columnDef) {}

View File

@ -40,6 +40,9 @@ class DatabasePlatformMock extends \Doctrine\DBAL\Platforms\AbstractPlatform
return $this->_sequenceNextValSql; return $this->_sequenceNextValSql;
} }
/** @override */
public function getBooleanTypeDeclarationSql(array $field) {}
/** @override */ /** @override */
public function getIntegerTypeDeclarationSql(array $field) {} public function getIntegerTypeDeclarationSql(array $field) {}

View File

@ -4,7 +4,7 @@ namespace Doctrine\Tests\Models\Generic;
/** /**
* @Entity * @Entity
* @Table(name="date_time_model") * @Table(name="decimal_model")
*/ */
class DecimalModel class DecimalModel
{ {

View File

@ -47,7 +47,20 @@ class MySqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase
$sql = $tool->getCreateSchemaSql($classes); $sql = $tool->getCreateSchemaSql($classes);
$this->assertEquals(1, count($sql)); $this->assertEquals(1, count($sql));
$this->assertEquals("CREATE TABLE date_time_model (id INT AUTO_INCREMENT NOT NULL, decimal NUMERIC(2, 5) NOT NULL, PRIMARY KEY(id)) ENGINE = InnoDB", $sql[0]); $this->assertEquals("CREATE TABLE decimal_model (id INT AUTO_INCREMENT NOT NULL, decimal NUMERIC(2, 5) NOT NULL, PRIMARY KEY(id)) ENGINE = InnoDB", $sql[0]);
}
public function testGetCreateSchemaSql3()
{
$classes = array(
$this->_em->getClassMetadata('Doctrine\Tests\Models\Generic\BooleanModel')
);
$tool = new SchemaTool($this->_em);
$sql = $tool->getCreateSchemaSql($classes);
$this->assertEquals(1, count($sql));
$this->assertEquals("CREATE TABLE boolean_model (id INT AUTO_INCREMENT NOT NULL, boolean DEFAULT 1 NOT NULL, PRIMARY KEY(id)) ENGINE = InnoDB", $sql[0]);
} }
public function testGetUpdateSchemaSql() public function testGetUpdateSchemaSql()