diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-06-06 16:40:11 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-06-06 16:40:11 +0200 |
commit | 647dcce514a22636d83e7de76dd0dfde82098fa6 (patch) | |
tree | 15d7efc8ed023b7019a425a21b1a13a8cbd3152e /tests/lib/db/mdb2schemamanager.php | |
parent | c053f2738162ae50da886833004bf39aed8387a5 (diff) | |
parent | fe8bae31dc80ac832323fa8d9a75fd4b543d36e0 (diff) | |
download | nextcloud-server-647dcce514a22636d83e7de76dd0dfde82098fa6.tar.gz nextcloud-server-647dcce514a22636d83e7de76dd0dfde82098fa6.zip |
Merge pull request #8253 from owncloud/pk-on-all-tables-master
Primary keys on all tables master
Diffstat (limited to 'tests/lib/db/mdb2schemamanager.php')
-rw-r--r-- | tests/lib/db/mdb2schemamanager.php | 37 |
1 files changed, 37 insertions, 0 deletions
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 @@ +<?php + +/** + * Copyright (c) 2014 Thomas Müller <deepdiver@owncloud.com> + * 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); + } + +} |