diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-06-17 16:43:33 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-06-17 16:43:33 +0200 |
commit | cce58368ad03f4ef3d8a1ad3e26e09fc51ca716a (patch) | |
tree | faf224c81f5e901710251072e9afde385fefb72e /tests | |
parent | c5e33f517218421d5b4e6984bcdf84117434a357 (diff) | |
parent | ffdc1c2fcfd3fe05bd8d5b58839d3610ece0a03e (diff) | |
download | nextcloud-server-cce58368ad03f4ef3d8a1ad3e26e09fc51ca716a.tar.gz nextcloud-server-cce58368ad03f4ef3d8a1ad3e26e09fc51ca716a.zip |
Merge pull request #9065 from owncloud/migrator-keepprimaryindexname
Do not rename primary key index when renaming table
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/db/migrator.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/lib/db/migrator.php b/tests/lib/db/migrator.php index e9b986236b8..e94d550f836 100644 --- a/tests/lib/db/migrator.php +++ b/tests/lib/db/migrator.php @@ -119,4 +119,25 @@ class Migrator extends \PHPUnit_Framework_TestCase { $this->assertTrue(true); } } + + public function testAddingPrimaryKeyWithAutoIncrement() { + $startSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $table = $startSchema->createTable($this->tableName); + $table->addColumn('id', 'integer'); + $table->addColumn('name', 'string'); + + $endSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $table = $endSchema->createTable($this->tableName); + $table->addColumn('id', 'integer', array('autoincrement' => true)); + $table->addColumn('name', 'string'); + $table->setPrimaryKey(array('id')); + + $migrator = $this->getMigrator(); + $migrator->migrate($startSchema); + + $migrator->checkMigrate($endSchema); + $migrator->migrate($endSchema); + + $this->assertTrue(true); + } } |