Commit 488183a8 authored by Steve Müller's avatar Steve Müller Committed by Marco Pivetta

add test case for adding non autoincrement column to primary key with autoincrement column on MySQL

parent d1929749
......@@ -411,6 +411,33 @@ abstract class AbstractMySQLPlatformTestCase extends AbstractPlatformTestCase
);
}
/**
* @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
*/
......
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