Commit 03144c4d authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge pull request #505 from deeky666/add-postgresql-92-smallserial-support

Add SMALLSERIAL type support on PostgreSQL 9.2 platform
parents 5d0e0ccc 615ce541
...@@ -36,6 +36,18 @@ class PostgreSQL92Platform extends PostgreSqlPlatform ...@@ -36,6 +36,18 @@ class PostgreSQL92Platform extends PostgreSqlPlatform
return 'JSON'; return 'JSON';
} }
/**
* {@inheritdoc}
*/
public function getSmallIntTypeDeclarationSQL(array $field)
{
if ( ! empty($field['autoincrement'])) {
return 'SMALLSERIAL';
}
return parent::getSmallIntTypeDeclarationSQL($field);
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -30,6 +30,24 @@ class PostgreSQL92PlatformTest extends AbstractPostgreSqlPlatformTestCase ...@@ -30,6 +30,24 @@ class PostgreSQL92PlatformTest extends AbstractPostgreSqlPlatformTestCase
$this->assertSame('JSON', $this->_platform->getJsonTypeDeclarationSQL(array())); $this->assertSame('JSON', $this->_platform->getJsonTypeDeclarationSQL(array()));
} }
public function testReturnsSmallIntTypeDeclarationSQL()
{
$this->assertSame(
'SMALLSERIAL',
$this->_platform->getSmallIntTypeDeclarationSQL(array('autoincrement' => true))
);
$this->assertSame(
'SMALLINT',
$this->_platform->getSmallIntTypeDeclarationSQL(array('autoincrement' => false))
);
$this->assertSame(
'SMALLINT',
$this->_platform->getSmallIntTypeDeclarationSQL(array())
);
}
/** /**
* @group DBAL-553 * @group DBAL-553
*/ */
......
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