[2.0] Other fixes, removed E_FATAL of duplicate declaration and added test for Boolean type
This commit is contained in:
parent
4d4374395b
commit
3ef0bf50e9
@ -325,14 +325,6 @@ class MsSqlPlatform extends AbstractPlatform
|
||||
return 'SET TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSql($level);
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function getBooleanTypeDeclarationSql(array $field)
|
||||
{
|
||||
return 'BIT';
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
@ -374,7 +366,9 @@ class MsSqlPlatform extends AbstractPlatform
|
||||
: ($length ? 'VARCHAR(' . $length . ')' : 'TEXT');
|
||||
}
|
||||
|
||||
/** @override */
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
protected function _getCommonIntegerTypeDeclarationSql(array $columnDef)
|
||||
{
|
||||
$autoinc = '';
|
||||
|
@ -193,14 +193,6 @@ class OraclePlatform extends AbstractPlatform
|
||||
return 'TIMESTAMP(0) WITH TIME ZONE';
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function getBooleanTypeDeclarationSql(array $field)
|
||||
{
|
||||
return 'NUMBER(1)';
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
|
@ -712,14 +712,6 @@ class PostgreSqlPlatform extends AbstractPlatform
|
||||
return 'DATE';
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function getBooleanTypeDeclarationSql(array $field)
|
||||
{
|
||||
return 'BOOLEAN';
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
|
@ -6,6 +6,7 @@ use Doctrine\DBAL\Platforms;
|
||||
|
||||
class MockPlatform extends \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
{
|
||||
public function getBooleanTypeDeclarationSql(array $columnDef) {}
|
||||
public function getIntegerTypeDeclarationSql(array $columnDef) {}
|
||||
public function getBigIntTypeDeclarationSql(array $columnDef) {}
|
||||
public function getSmallIntTypeDeclarationSql(array $columnDef) {}
|
||||
|
@ -40,6 +40,9 @@ class DatabasePlatformMock extends \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
return $this->_sequenceNextValSql;
|
||||
}
|
||||
|
||||
/** @override */
|
||||
public function getBooleanTypeDeclarationSql(array $field) {}
|
||||
|
||||
/** @override */
|
||||
public function getIntegerTypeDeclarationSql(array $field) {}
|
||||
|
||||
|
@ -4,7 +4,7 @@ namespace Doctrine\Tests\Models\Generic;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="date_time_model")
|
||||
* @Table(name="decimal_model")
|
||||
*/
|
||||
class DecimalModel
|
||||
{
|
||||
|
@ -47,7 +47,20 @@ class MySqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$sql = $tool->getCreateSchemaSql($classes);
|
||||
|
||||
$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()
|
||||
|
Loading…
Reference in New Issue
Block a user