Commit 1770ffa8 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge branch 'DBAL-792' into 2.4

parents 94ba3d35 86fc3eab
...@@ -220,7 +220,7 @@ class SqliteSchemaManager extends AbstractSchemaManager ...@@ -220,7 +220,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
$autoincrementColumn = null; $autoincrementColumn = null;
$autoincrementCount = 0; $autoincrementCount = 0;
foreach ($tableColumns as $tableColumn) { foreach ($tableColumns as $tableColumn) {
if ('1' == $tableColumn['pk']) { if ('0' != $tableColumn['pk']) {
$autoincrementCount++; $autoincrementCount++;
if (null === $autoincrementColumn && 'integer' == strtolower($tableColumn['type'])) { if (null === $autoincrementColumn && 'integer' == strtolower($tableColumn['type'])) {
$autoincrementColumn = $tableColumn['name']; $autoincrementColumn = $tableColumn['name'];
......
...@@ -481,6 +481,28 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest ...@@ -481,6 +481,28 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$this->assertTrue($inferredTable->getColumn('id')->getAutoincrement()); $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 * @group DDC-887
*/ */
......
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