summaryrefslogtreecommitdiffstats
path: root/tests/lib/db/mdb2schemamanager.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-06-06 16:40:11 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-06-06 16:40:11 +0200
commit647dcce514a22636d83e7de76dd0dfde82098fa6 (patch)
tree15d7efc8ed023b7019a425a21b1a13a8cbd3152e /tests/lib/db/mdb2schemamanager.php
parentc053f2738162ae50da886833004bf39aed8387a5 (diff)
parentfe8bae31dc80ac832323fa8d9a75fd4b543d36e0 (diff)
downloadnextcloud-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.php37
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);
+ }
+
+}