Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bartv2 committed Feb 18, 2014
1 parent c7b4cdb commit a5daf7e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ protected function _getPortableTableColumnList($table, $database, $tableColumns)
$autoincrementColumn = null;
$autoincrementCount = 0;
foreach ($tableColumns as $tableColumn) {
if ('1' == $tableColumn['pk']) {
if ('0' != $tableColumn['pk']) {
$autoincrementCount++;
if (null === $autoincrementColumn && 'integer' == strtolower($tableColumn['type'])) {
$autoincrementColumn = $tableColumn['name'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,28 @@ public function testAutoincrementDetection()
$this->assertTrue($inferredTable->getColumn('id')->getAutoincrement());
}

/**
* @group DBAL-792
*/
public function testAutoincrementDetectionMulticolumns()
{
if (!$this->_sm->getDatabasePlatform()->supportsIdentityColumns()) {
$this->markTestSkipped('This test is only supported on platforms that have autoincrement');
}

$table = new \Doctrine\DBAL\Schema\Table('test_not_autoincrement');
$table->setSchemaConfig($this->_sm->createSchemaConfig());
$table->addColumn('id', 'integer');
$table->addColumn('other_id', 'integer');
$table->setPrimaryKey(array('id', 'other_id'));

$this->_sm->createTable($table);

$inferredTable = $this->_sm->listTableDetails('test_not_autoincrement');
$this->assertTrue($inferredTable->hasColumn('id'));
$this->assertFalse($inferredTable->getColumn('id')->getAutoincrement());
}

/**
* @group DDC-887
*/
Expand Down

0 comments on commit a5daf7e

Please sign in to comment.