Skip to content

Commit

Permalink
add test case for adding non autoincrement column to primary key with…
Browse files Browse the repository at this point in the history
… autoincrement column on MySQL
  • Loading branch information
deeky666 authored and Ocramius committed Sep 9, 2016
1 parent 1411f14 commit 8dd933e
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,33 @@ public function testDropNonAutoincrementColumnFromCompositePrimaryKeyWithAutoinc
);
}

/**
* @group DBAL-2302
*/
public function testAddNonAutoincrementColumnToPrimaryKeyWithAutoincrementColumn()
{
$table = new Table("tbl");
$table->addColumn('id', 'integer', array('autoincrement' => true));
$table->addColumn('foo', 'integer');
$table->addColumn('bar', 'integer');
$table->setPrimaryKey(array('id'));

$comparator = new Comparator();
$diffTable = clone $table;

$diffTable->dropPrimaryKey();
$diffTable->setPrimaryKey(array('id', 'foo'));

$this->assertSame(
array(
'ALTER TABLE tbl MODIFY id INT NOT NULL',
'ALTER TABLE tbl DROP PRIMARY KEY',
'ALTER TABLE tbl ADD PRIMARY KEY (id, foo)',
),
$this->_platform->getAlterTableSQL($comparator->diffTable($table, $diffTable))
);
}

/**
* @group DBAL-586
*/
Expand Down

0 comments on commit 8dd933e

Please sign in to comment.