From fe8bae31dc80ac832323fa8d9a75fd4b543d36e0 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Thu, 17 Apr 2014 16:12:48 +0200 Subject: adding PK to table encryption adding auto increment/PK to table files_trash adding PK to table ldap_user_mapping and ldap_group_members adding PK to table ldap_group_mapping truncate permissions table to allow smooth creation of primary key adding unit test for creating an auto increment column on a table which already contains data remove unneeded table files_trashsizes fix unit test no need to truncate *PREFIX*permissions On Oracle adding auto increment columns is not working out of the box - Oracle migrations are to be done manually --- tests/lib/db/mdb2schemamanager.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/lib/db/mdb2schemamanager.php (limited to 'tests/lib/db/mdb2schemamanager.php') diff --git a/tests/lib/db/mdb2schemamanager.php b/tests/lib/db/mdb2schemamanager.php new file mode 100644 index 00000000000..51e3c7002f4 --- /dev/null +++ b/tests/lib/db/mdb2schemamanager.php @@ -0,0 +1,37 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace Test\DB; + +class MDB2SchemaManager extends \PHPUnit_Framework_TestCase { + + public function tearDown() { + \OC_DB::dropTable('table'); + } + + public function testAutoIncrement() { + + if (\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite') === 'oci') { + $this->markTestSkipped('Adding auto increment columns in Oracle is not supported.'); + } + + $connection = \OC_DB::getConnection(); + $manager = new \OC\DB\MDB2SchemaManager($connection); + + $manager->createDbFromStructure(__DIR__ . '/ts-autoincrement-before.xml'); + $connection->executeUpdate('insert into `*PREFIX*table` values (?)', array('abc')); + $connection->executeUpdate('insert into `*PREFIX*table` values (?)', array('abc')); + $connection->executeUpdate('insert into `*PREFIX*table` values (?)', array('123')); + $connection->executeUpdate('insert into `*PREFIX*table` values (?)', array('123')); + $manager->updateDbFromStructure(__DIR__ . '/ts-autoincrement-after.xml'); + + $this->assertTrue(true); + } + +} -- cgit v1.2.3