diff options
author | Morris Jobke <hey@morrisjobke.de> | 2021-03-24 20:27:39 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2021-03-24 22:15:44 +0100 |
commit | ab48d5e8cbb653767070a286650b87ae97461f37 (patch) | |
tree | 57888a2d7b536c94bcc309e33566ea0db840c2d7 /tests/lib/DB | |
parent | bb0c50717cd604ffeafacafe901a70c894ed29f3 (diff) | |
download | nextcloud-server-ab48d5e8cbb653767070a286650b87ae97461f37.tar.gz nextcloud-server-ab48d5e8cbb653767070a286650b87ae97461f37.zip |
Cleanup unneeded code around database.xml
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'tests/lib/DB')
-rw-r--r-- | tests/lib/DB/ConnectionTest.php | 375 | ||||
-rw-r--r-- | tests/lib/DB/DBSchemaTest.php | 106 | ||||
-rw-r--r-- | tests/lib/DB/LegacyDBTest.php | 323 | ||||
-rw-r--r-- | tests/lib/DB/MDB2SchemaManagerTest.php | 49 | ||||
-rw-r--r-- | tests/lib/DB/MDB2SchemaReaderTest.php | 103 | ||||
-rw-r--r-- | tests/lib/DB/MigratorTest.php | 41 | ||||
-rw-r--r-- | tests/lib/DB/MySqlMigrationTest.php | 48 | ||||
-rw-r--r-- | tests/lib/DB/SchemaDiffTest.php | 108 | ||||
-rw-r--r-- | tests/lib/DB/SqliteMigrationTest.php | 48 | ||||
-rw-r--r-- | tests/lib/DB/schemDiffData/autoincrement.xml | 16 | ||||
-rw-r--r-- | tests/lib/DB/schemDiffData/clob.xml | 14 | ||||
-rw-r--r-- | tests/lib/DB/schemDiffData/core.xml | 1347 | ||||
-rw-r--r-- | tests/lib/DB/schemDiffData/default-1.xml | 51 | ||||
-rw-r--r-- | tests/lib/DB/schemDiffData/unsigned.xml | 68 | ||||
-rw-r--r-- | tests/lib/DB/testschema.xml | 99 | ||||
-rw-r--r-- | tests/lib/DB/ts-autoincrement-after.xml | 32 | ||||
-rw-r--r-- | tests/lib/DB/ts-autoincrement-before.xml | 24 |
17 files changed, 29 insertions, 2823 deletions
diff --git a/tests/lib/DB/ConnectionTest.php b/tests/lib/DB/ConnectionTest.php deleted file mode 100644 index d628d9814e0..00000000000 --- a/tests/lib/DB/ConnectionTest.php +++ /dev/null @@ -1,375 +0,0 @@ -<?php - -/** - * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ - -namespace Test\DB; - -use Doctrine\DBAL\Platforms\SqlitePlatform; -use OC\DB\MDB2SchemaManager; -use OCP\DB\QueryBuilder\IQueryBuilder; - -/** - * Class Connection - * - * @group DB - * - * @package Test\DB - */ -class ConnectionTest extends \Test\TestCase { - /** - * @var \OCP\IDBConnection - */ - private $connection; - - public static function setUpBeforeClass(): void { - self::dropTestTable(); - parent::setUpBeforeClass(); - } - - public static function tearDownAfterClass(): void { - self::dropTestTable(); - parent::tearDownAfterClass(); - } - - protected static function dropTestTable() { - if (\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite') !== 'oci') { - \OC::$server->getDatabaseConnection()->dropTable('table'); - } - } - - protected function setUp(): void { - parent::setUp(); - $this->connection = \OC::$server->get(\OC\DB\Connection::class); - } - - protected function tearDown(): void { - parent::tearDown(); - $this->connection->dropTable('table'); - } - - /** - * @param string $table - */ - public function assertTableExist($table) { - if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) { - // sqlite removes the tables after closing the DB - $this->addToAssertionCount(1); - } else { - $this->assertTrue($this->connection->tableExists($table), 'Table ' . $table . ' exists.'); - } - } - - /** - * @param string $table - */ - public function assertTableNotExist($table) { - if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) { - // sqlite removes the tables after closing the DB - $this->addToAssertionCount(1); - } else { - $this->assertFalse($this->connection->tableExists($table), 'Table ' . $table . " doesn't exist."); - } - } - - private function makeTestTable() { - $schemaManager = new MDB2SchemaManager($this->connection); - $schemaManager->createDbFromStructure(__DIR__ . '/testschema.xml'); - } - - public function testTableExists() { - $this->assertTableNotExist('table'); - $this->makeTestTable(); - $this->assertTableExist('table'); - } - - /** - * @depends testTableExists - */ - public function testDropTable() { - $this->makeTestTable(); - $this->assertTableExist('table'); - $this->connection->dropTable('table'); - $this->assertTableNotExist('table'); - } - - private function getTextValueByIntegerField($integerField) { - $builder = $this->connection->getQueryBuilder(); - $query = $builder->select('*') - ->from('table') - ->where($builder->expr()->eq('integerfield', $builder->createNamedParameter($integerField, IQueryBuilder::PARAM_INT))); - - $result = $query->execute(); - $row = $result->fetch(); - $result->closeCursor(); - - return $row['textfield'] ?? null; - } - - public function testSetValues() { - $this->makeTestTable(); - $this->connection->setValues('table', [ - 'integerfield' => 1 - ], [ - 'textfield' => 'foo', - 'clobfield' => 'not_null' - ]); - - $this->assertEquals('foo', $this->getTextValueByIntegerField(1)); - } - - public function testSetValuesOverWrite() { - $this->makeTestTable(); - $this->connection->setValues('table', [ - 'integerfield' => 1 - ], [ - 'textfield' => 'foo' - ]); - - $this->connection->setValues('table', [ - 'integerfield' => 1 - ], [ - 'textfield' => 'bar' - ]); - - $this->assertEquals('bar', $this->getTextValueByIntegerField(1)); - } - - public function testSetValuesOverWritePrecondition() { - $this->makeTestTable(); - $this->connection->setValues('table', [ - 'integerfield' => 1 - ], [ - 'textfield' => 'foo', - 'booleanfield' => true, - 'clobfield' => 'not_null' - ]); - - $this->connection->setValues('table', [ - 'integerfield' => 1 - ], [ - 'textfield' => 'bar' - ], [ - 'booleanfield' => true - ]); - - $this->assertEquals('bar', $this->getTextValueByIntegerField(1)); - } - - - public function testSetValuesOverWritePreconditionFailed() { - $this->expectException(\OCP\PreConditionNotMetException::class); - - $this->makeTestTable(); - $this->connection->setValues('table', [ - 'integerfield' => 1 - ], [ - 'textfield' => 'foo', - 'booleanfield' => true, - 'clobfield' => 'not_null' - ]); - - $this->connection->setValues('table', [ - 'integerfield' => 1 - ], [ - 'textfield' => 'bar' - ], [ - 'booleanfield' => false - ]); - } - - public function testSetValuesSameNoError() { - $this->makeTestTable(); - $this->connection->setValues('table', [ - 'integerfield' => 1 - ], [ - 'textfield' => 'foo', - 'clobfield' => 'not_null' - ]); - - // this will result in 'no affected rows' on certain optimizing DBs - // ensure the PreConditionNotMetException isn't thrown - $this->connection->setValues('table', [ - 'integerfield' => 1 - ], [ - 'textfield' => 'foo' - ]); - - $this->addToAssertionCount(1); - } - - public function testInsertIfNotExist() { - if (\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite') === 'oci') { - self::markTestSkipped('Insert if not exist does not work with clob on oracle'); - } - - $this->makeTestTable(); - $categoryEntries = [ - ['user' => 'test', 'category' => 'Family', 'expectedResult' => 1], - ['user' => 'test', 'category' => 'Friends', 'expectedResult' => 1], - ['user' => 'test', 'category' => 'Coworkers', 'expectedResult' => 1], - ['user' => 'test', 'category' => 'Coworkers', 'expectedResult' => 0], - ['user' => 'test', 'category' => 'School', 'expectedResult' => 1], - ['user' => 'test2', 'category' => 'Coworkers2', 'expectedResult' => 1], - ['user' => 'test2', 'category' => 'Coworkers2', 'expectedResult' => 0], - ['user' => 'test2', 'category' => 'School2', 'expectedResult' => 1], - ['user' => 'test2', 'category' => 'Coworkers', 'expectedResult' => 1], - ]; - - $row = 0; - foreach ($categoryEntries as $entry) { - $result = $this->connection->insertIfNotExist('*PREFIX*table', - [ - 'textfield' => $entry['user'], - 'clobfield' => $entry['category'], - 'integerfield' => $row++, - ], ['textfield', 'clobfield']); - $this->assertEquals($entry['expectedResult'], $result, json_encode($entry)); - } - - $query = $this->connection->prepare('SELECT * FROM `*PREFIX*table`'); - $result = $query->execute(); - $this->assertTrue((bool)$result); - $this->assertEquals(7, count($result->fetchAll())); - } - - public function testInsertIfNotExistNull() { - if (\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite') === 'oci') { - self::markTestSkipped('Insert if not exist does not work with clob on oracle'); - } - - $this->makeTestTable(); - $categoryEntries = [ - ['addressbookid' => 123, 'fullname' => null, 'expectedResult' => 1], - ['addressbookid' => 123, 'fullname' => null, 'expectedResult' => 0], - ['addressbookid' => 123, 'fullname' => 'test', 'expectedResult' => 1], - ]; - - $row = 0; - foreach ($categoryEntries as $entry) { - $result = $this->connection->insertIfNotExist('*PREFIX*table', - [ - 'integerfield_default' => $entry['addressbookid'], - 'clobfield' => $entry['fullname'], - 'integerfield' => $row++, - ], ['integerfield_default', 'clobfield']); - $this->assertEquals($entry['expectedResult'], $result, json_encode($entry)); - } - - $query = $this->connection->prepare('SELECT * FROM `*PREFIX*table`'); - $result = $query->execute(); - $this->assertTrue((bool)$result); - $this->assertEquals(2, count($result->fetchAll())); - } - - public function testInsertIfNotExistDonTOverwrite() { - if (\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite') === 'oci') { - self::markTestSkipped('Insert if not exist does not work with clob on oracle'); - } - - $this->makeTestTable(); - $fullName = 'fullname test'; - $uri = 'uri_1'; - - // Normal test to have same known data inserted. - $query = $this->connection->prepare('INSERT INTO `*PREFIX*table` (`textfield`, `clobfield`) VALUES (?, ?)'); - $result = $query->execute([$fullName, $uri]); - $this->assertEquals(1, $result->rowCount()); - $query = $this->connection->prepare('SELECT `textfield`, `clobfield` FROM `*PREFIX*table` WHERE `clobfield` = ?'); - $result = $query->execute([$uri]); - $rowset = $result->fetchAll(); - $this->assertEquals(1, count($rowset)); - $this->assertArrayHasKey('textfield', $rowset[0]); - $this->assertEquals($fullName, $rowset[0]['textfield']); - - // Try to insert a new row - $result = $this->connection->insertIfNotExist('*PREFIX*table', - [ - 'textfield' => $fullName, - 'clobfield' => $uri, - ]); - $this->assertEquals(0, $result); - - $query = $this->connection->prepare('SELECT `textfield`, `clobfield` FROM `*PREFIX*table` WHERE `clobfield` = ?'); - $result = $query->execute([$uri]); - // Test that previously inserted data isn't overwritten - // And that a new row hasn't been inserted. - $rowset = $result->fetchAll(); - $this->assertEquals(1, count($rowset)); - $this->assertArrayHasKey('textfield', $rowset[0]); - $this->assertEquals($fullName, $rowset[0]['textfield']); - } - - public function testInsertIfNotExistsViolating() { - if (\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite') === 'oci') { - self::markTestSkipped('Insert if not exist does not work with clob on oracle'); - } - - $this->makeTestTable(); - $result = $this->connection->insertIfNotExist('*PREFIX*table', - [ - 'textfield' => md5('welcome.txt'), - 'clobfield' => $this->getUniqueID() - ]); - $this->assertEquals(1, $result); - - $result = $this->connection->insertIfNotExist('*PREFIX*table', - [ - 'textfield' => md5('welcome.txt'), - 'clobfield' => $this->getUniqueID() - ],['textfield']); - - $this->assertEquals(0, $result); - } - - public function insertIfNotExistsViolatingThrows() { - return [ - [null], - [['clobfield']], - ]; - } - - /** - * @dataProvider insertIfNotExistsViolatingThrows - * - * @param array $compareKeys - */ - public function testInsertIfNotExistsViolatingUnique($compareKeys) { - if (\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite') === 'oci') { - self::markTestSkipped('Insert if not exist does not work with clob on oracle'); - } - - $this->makeTestTable(); - $result = $this->connection->insertIfNotExist('*PREFIX*table', - [ - 'integerfield' => 1, - 'clobfield' => $this->getUniqueID() - ]); - $this->assertEquals(1, $result); - - $result = $this->connection->insertIfNotExist('*PREFIX*table', - [ - 'integerfield' => 1, - 'clobfield' => $this->getUniqueID() - ], $compareKeys); - - $this->assertEquals(0, $result); - } - - - public function testUniqueConstraintViolating() { - $this->expectException(\Doctrine\DBAL\Exception\UniqueConstraintViolationException::class); - - $this->makeTestTable(); - - $testQuery = 'INSERT INTO `*PREFIX*table` (`integerfield`, `textfield`) VALUES(?, ?)'; - $testParams = [1, 'hello']; - - $this->connection->executeUpdate($testQuery, $testParams); - $this->connection->executeUpdate($testQuery, $testParams); - } -} diff --git a/tests/lib/DB/DBSchemaTest.php b/tests/lib/DB/DBSchemaTest.php deleted file mode 100644 index 4f24c3f67aa..00000000000 --- a/tests/lib/DB/DBSchemaTest.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php -/** - * Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl> - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ - -namespace Test\DB; - -use Doctrine\DBAL\Platforms\SqlitePlatform; -use OC_DB; -use OCP\ITempManager; -use OCP\Security\ISecureRandom; -use Test\TestCase; - -/** - * Class DBSchemaTest - * - * @group DB - */ -class DBSchemaTest extends TestCase { - protected $schema_file; - protected $schema_file2; - protected $table1; - protected $table2; - /** @var ITempManager */ - protected $tempManager; - - protected function setUp(): void { - parent::setUp(); - - $this->tempManager = \OC::$server->getTempManager(); - $this->schema_file = $this->tempManager->getTemporaryFile(); - $this->schema_file2 = $this->tempManager->getTemporaryFile(); - - $dbfile = \OC::$SERVERROOT.'/tests/data/db_structure.xml'; - $dbfile2 = \OC::$SERVERROOT.'/tests/data/db_structure2.xml'; - - $r = '_' . \OC::$server->getSecureRandom()-> - generate(4, ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS) . '_'; - $content = file_get_contents($dbfile); - $content = str_replace('*dbprefix*', '*dbprefix*'.$r, $content); - file_put_contents($this->schema_file, $content); - $content = file_get_contents($dbfile2); - $content = str_replace('*dbprefix*', '*dbprefix*'.$r, $content); - file_put_contents($this->schema_file2, $content); - - $this->table1 = $r.'cntcts_addrsbks'; - $this->table2 = $r.'cntcts_cards'; - } - - protected function tearDown(): void { - unlink($this->schema_file); - unlink($this->schema_file2); - - parent::tearDown(); - } - - // everything in one test, they depend on each other - /** - * @medium - */ - public function testSchema() { - $this->doTestSchemaCreating(); - $this->doTestSchemaChanging(); - $this->doTestSchemaRemoving(); - } - - public function doTestSchemaCreating() { - OC_DB::createDbFromStructure($this->schema_file); - $this->assertTableExist($this->table1); - $this->assertTableExist($this->table2); - } - - public function doTestSchemaChanging() { - OC_DB::updateDbFromStructure($this->schema_file2); - $this->assertTableExist($this->table2); - } - - public function doTestSchemaRemoving() { - OC_DB::removeDBStructure($this->schema_file); - $this->assertTableNotExist($this->table1); - $this->assertTableNotExist($this->table2); - } - - /** - * @param string $table - */ - public function assertTableExist($table) { - $this->assertTrue(OC_DB::tableExists($table), 'Table ' . $table . ' does not exist'); - } - - /** - * @param string $table - */ - public function assertTableNotExist($table) { - $platform = \OC::$server->getDatabaseConnection()->getDatabasePlatform(); - if ($platform instanceof SqlitePlatform) { - // sqlite removes the tables after closing the DB - $this->addToAssertionCount(1); - } else { - $this->assertFalse(OC_DB::tableExists($table), 'Table ' . $table . ' exists.'); - } - } -} diff --git a/tests/lib/DB/LegacyDBTest.php b/tests/lib/DB/LegacyDBTest.php deleted file mode 100644 index d4913cbe6f5..00000000000 --- a/tests/lib/DB/LegacyDBTest.php +++ /dev/null @@ -1,323 +0,0 @@ -<?php -/** - * Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl> - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ - -namespace Test\DB; - -use OC_DB; - -/** - * Class LegacyDBTest - * - * @group DB - */ -class LegacyDBTest extends \Test\TestCase { - protected $backupGlobals = false; - - protected static $schema_file; - protected $test_prefix; - - public static function setUpBeforeClass(): void { - self::$schema_file = \OC::$server->getTempManager()->getTemporaryFile(); - } - - - /** - * @var string - */ - private $table1; - - /** - * @var string - */ - private $table2; - - /** - * @var string - */ - private $table3; - - /** - * @var string - */ - private $table4; - - /** - * @var string - */ - private $table5; - - /** - * @var string - */ - private $text_table; - - protected function setUp(): void { - parent::setUp(); - - $dbFile = \OC::$SERVERROOT.'/tests/data/db_structure.xml'; - - $r = $this->getUniqueID('_', 4).'_'; - $content = file_get_contents($dbFile); - $content = str_replace('*dbprefix*', '*dbprefix*'.$r, $content); - file_put_contents(self::$schema_file, $content); - OC_DB::createDbFromStructure(self::$schema_file); - - $this->test_prefix = $r; - $this->table1 = $this->test_prefix.'cntcts_addrsbks'; - $this->table2 = $this->test_prefix.'cntcts_cards'; - $this->table3 = $this->test_prefix.'vcategory'; - $this->table4 = $this->test_prefix.'decimal'; - $this->table5 = $this->test_prefix.'uniconst'; - $this->text_table = $this->test_prefix.'text_table'; - } - - protected function tearDown(): void { - OC_DB::removeDBStructure(self::$schema_file); - unlink(self::$schema_file); - - parent::tearDown(); - } - - public function testQuotes() { - $query = OC_DB::prepare('SELECT `fullname` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?'); - $result = $query->execute(['uri_1']); - $this->assertTrue((bool)$result); - $row = $result->fetchRow(); - $this->assertFalse($row); - $result->closeCursor(); - - $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (?,?)'); - $result = $query->execute(['fullname test', 'uri_1']); - $this->assertEquals(1, $result); - $query = OC_DB::prepare('SELECT `fullname`,`uri` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?'); - $result = $query->execute(['uri_1']); - $this->assertTrue((bool)$result); - $row = $result->fetchRow(); - $this->assertArrayHasKey('fullname', $row); - $this->assertEquals($row['fullname'], 'fullname test'); - $row = $result->fetchRow(); - $this->assertFalse((bool)$row); //PDO returns false, MDB2 returns null - $result->closeCursor(); - } - - /** - * @medium - */ - public function testNOW() { - $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (NOW(),?)'); - $result = $query->execute(['uri_2']); - $this->assertEquals(1, $result); - $query = OC_DB::prepare('SELECT `fullname`,`uri` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?'); - $result = $query->execute(['uri_2']); - $this->assertTrue((bool)$result); - $result->closeCursor(); - } - - public function testUNIX_TIMESTAMP() { - $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (UNIX_TIMESTAMP(),?)'); - $result = $query->execute(['uri_3']); - $this->assertEquals(1, $result); - $query = OC_DB::prepare('SELECT `fullname`,`uri` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?'); - $result = $query->execute(['uri_3']); - $this->assertTrue((bool)$result); - $result->closeCursor(); - } - - public function testLastInsertId() { - $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (?,?)'); - $result1 = OC_DB::executeAudited($query, ['insertid 1','uri_1']); - $id1 = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*'.$this->table2); - - // we don't know the id we should expect, so insert another row - $result2 = OC_DB::executeAudited($query, ['insertid 2','uri_2']); - $id2 = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*'.$this->table2); - // now we can check if the two ids are in correct order - $this->assertGreaterThan($id1, $id2); - } - - public function testUtf8Data() { - $table = "*PREFIX*{$this->table2}"; - $expected = "Ћö雙喜\xE2\x80\xA2"; - - $query = OC_DB::prepare("INSERT INTO `$table` (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)"); - $result = $query->execute([$expected, 'uri_1', 'This is a vCard']); - $this->assertEquals(1, $result); - - $query = OC_DB::prepare("SELECT `fullname` FROM `$table`"); - - $result = $query->execute(); - $actual = $result->fetchOne(); - $result->closeCursor(); - - $this->assertSame($expected, $actual); - } - - /** - * Insert, select and delete decimal(12,2) values - * @dataProvider decimalData - */ - public function XtestDecimal($insert, $expect) { - $table = "*PREFIX*" . $this->table4; - $rowname = 'decimaltest'; - - $query = OC_DB::prepare('INSERT INTO `' . $table . '` (`' . $rowname . '`) VALUES (?)'); - $result = $query->execute([$insert]); - $this->assertEquals(1, $result); - $query = OC_DB::prepare('SELECT `' . $rowname . '` FROM `' . $table . '`'); - $result = $query->execute(); - $this->assertTrue((bool)$result); - $row = $result->fetchRow(); - $result->closeCursor(); - $this->assertArrayHasKey($rowname, $row); - $this->assertEquals($expect, $row[$rowname]); - $query = OC_DB::prepare('DELETE FROM `' . $table . '`'); - $result = $query->execute(); - $this->assertTrue((bool)$result); - } - - public function decimalData() { - return [ - ['1337133713.37', '1337133713.37'], - ['1234567890', '1234567890.00'], - ]; - } - - public function testUpdateAffectedRowsNoMatch() { - $this->insertCardData('fullname1', 'uri1'); - // The WHERE clause does not match any rows - $this->assertSame(0, $this->updateCardData('fullname3', 'uri2')); - } - - public function testUpdateAffectedRowsDifferent() { - $this->insertCardData('fullname1', 'uri1'); - // The WHERE clause matches a single row and the value we are updating - // is different from the one already present. - $this->assertSame(1, $this->updateCardData('fullname1', 'uri2')); - } - - public function testUpdateAffectedRowsSame() { - $this->insertCardData('fullname1', 'uri1'); - // The WHERE clause matches a single row and the value we are updating - // to is the same as the one already present. MySQL reports 0 here when - // the PDO::MYSQL_ATTR_FOUND_ROWS flag is not specified. - $this->assertSame(1, $this->updateCardData('fullname1', 'uri1')); - } - - public function testUpdateAffectedRowsMultiple() { - $this->insertCardData('fullname1', 'uri1'); - $this->insertCardData('fullname2', 'uri2'); - // The WHERE clause matches two rows. One row contains a value that - // needs to be updated, the other one already contains the value we are - // updating to. MySQL reports 1 here when the PDO::MYSQL_ATTR_FOUND_ROWS - // flag is not specified. - $query = OC_DB::prepare("UPDATE `*PREFIX*{$this->table2}` SET `uri` = ?"); - $this->assertSame(2, $query->execute(['uri1'])); - } - - protected function insertCardData($fullname, $uri) { - $query = OC_DB::prepare("INSERT INTO `*PREFIX*{$this->table2}` (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)"); - $this->assertSame(1, $query->execute([$fullname, $uri, $this->getUniqueID()])); - } - - protected function updateCardData($fullname, $uri) { - $query = OC_DB::prepare("UPDATE `*PREFIX*{$this->table2}` SET `uri` = ? WHERE `fullname` = ?"); - return $query->execute([$uri, $fullname]); - } - - public function testILIKE() { - $table = "*PREFIX*{$this->table2}"; - - $query = OC_DB::prepare("INSERT INTO `$table` (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)"); - $query->execute(['fooBAR', 'foo', 'bar']); - - $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` LIKE ?"); - $result = $query->execute(['foobar']); - $this->assertCount(0, $result->fetchAll()); - $result->closeCursor(); - - $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?"); - $result = $query->execute(['foobar']); - $this->assertCount(1, $result->fetchAll()); - $result->closeCursor(); - - $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?"); - $result = $query->execute(['foo']); - $this->assertCount(0, $result->fetchAll()); - $result->closeCursor(); - } - - public function testILIKEWildcard() { - $table = "*PREFIX*{$this->table2}"; - - $query = OC_DB::prepare("INSERT INTO `$table` (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)"); - $query->execute(['FooBAR', 'foo', 'bar']); - - $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` LIKE ?"); - $result = $query->execute(['%bar']); - $this->assertCount(0, $result->fetchAll()); - $result->closeCursor(); - - $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` LIKE ?"); - $result = $query->execute(['foo%']); - $this->assertCount(0, $result->fetchAll()); - $result->closeCursor(); - - $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` LIKE ?"); - $result = $query->execute(['%ba%']); - $this->assertCount(0, $result->fetchAll()); - $result->closeCursor(); - - $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?"); - $result = $query->execute(['%bar']); - $this->assertCount(1, $result->fetchAll()); - $result->closeCursor(); - - $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?"); - $result = $query->execute(['foo%']); - $this->assertCount(1, $result->fetchAll()); - $result->closeCursor(); - - $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?"); - $result = $query->execute(['%ba%']); - $this->assertCount(1, $result->fetchAll()); - $result->closeCursor(); - } - - /** - * @dataProvider insertAndSelectDataProvider - */ - public function testInsertAndSelectData($expected, $throwsOnMysqlWithoutUTF8MB4) { - $table = "*PREFIX*{$this->text_table}"; - $config = \OC::$server->getConfig(); - - $query = OC_DB::prepare("INSERT INTO `$table` (`textfield`) VALUES (?)"); - if ($throwsOnMysqlWithoutUTF8MB4 && $config->getSystemValue('dbtype', 'sqlite') === 'mysql' && $config->getSystemValue('mysql.utf8mb4', false) === false) { - $this->markTestSkipped('MySQL requires UTF8mb4 to store value: ' . $expected); - } - $result = $query->execute([$expected]); - $this->assertEquals(1, $result); - - $query = OC_DB::prepare("SELECT `textfield` FROM `$table`"); - - $result = $query->execute(); - $actual = $result->fetchOne(); - $result->closeCursor(); - $this->assertSame($expected, $actual); - } - - public function insertAndSelectDataProvider() { - return [ - ['abcdefghijklmnopqrstuvwxyzABCDEFGHIKLMNOPQRSTUVWXYZ', false], - ['0123456789', false], - ['äöüÄÖÜß!"§$%&/()=?#\'+*~°^`´', false], - ['²³¼½¬{[]}\\', false], - ['♡⚗', false], - ['💩', true], # :hankey: on github - ]; - } -} diff --git a/tests/lib/DB/MDB2SchemaManagerTest.php b/tests/lib/DB/MDB2SchemaManagerTest.php deleted file mode 100644 index 693de746b5e..00000000000 --- a/tests/lib/DB/MDB2SchemaManagerTest.php +++ /dev/null @@ -1,49 +0,0 @@ -<?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; - -use Doctrine\DBAL\Platforms\OraclePlatform; - -/** - * Class MDB2SchemaManager - * - * @group DB - * - * @package Test\DB - */ -class MDB2SchemaManagerTest extends \Test\TestCase { - protected function tearDown(): void { - // do not drop the table for Oracle as it will create a bogus transaction - // that will break the following test suites requiring transactions - if (\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite') !== 'oci') { - \OC::$server->getDatabaseConnection()->dropTable('table'); - } - - parent::tearDown(); - } - - public function testAutoIncrement() { - $connection = \OC::$server->get(\OC\DB\Connection::class); - if ($connection->getDatabasePlatform() instanceof OraclePlatform) { - $this->markTestSkipped('Adding auto increment columns in Oracle is not supported.'); - } - - $manager = new \OC\DB\MDB2SchemaManager($connection); - - $manager->createDbFromStructure(__DIR__ . '/ts-autoincrement-before.xml'); - $connection->executeUpdate('insert into `*PREFIX*table` values (?)', ['abc']); - $connection->executeUpdate('insert into `*PREFIX*table` values (?)', ['abc']); - $connection->executeUpdate('insert into `*PREFIX*table` values (?)', ['123']); - $connection->executeUpdate('insert into `*PREFIX*table` values (?)', ['123']); - $manager->updateDbFromStructure(__DIR__ . '/ts-autoincrement-after.xml'); - - $this->addToAssertionCount(1); - } -} diff --git a/tests/lib/DB/MDB2SchemaReaderTest.php b/tests/lib/DB/MDB2SchemaReaderTest.php deleted file mode 100644 index 1e7d3a20b7c..00000000000 --- a/tests/lib/DB/MDB2SchemaReaderTest.php +++ /dev/null @@ -1,103 +0,0 @@ -<?php - -/** - * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ - -namespace Test\DB; - -use Doctrine\DBAL\Platforms\MySQLPlatform; -use Doctrine\DBAL\Schema\Schema; -use OC\DB\MDB2SchemaReader; -use OCP\IConfig; -use Test\TestCase; -use Doctrine\DBAL\Types\IntegerType; -use Doctrine\DBAL\Types\TextType; -use Doctrine\DBAL\Types\StringType; -use Doctrine\DBAL\Types\BooleanType; - -/** - * Class MDB2SchemaReaderTest - * - * @group DB - * - * @package Test\DB - */ -class MDB2SchemaReaderTest extends TestCase { - /** - * @var MDB2SchemaReader $reader - */ - protected $reader; - - /** - * @return IConfig - */ - protected function getConfig() { - /** @var IConfig | \PHPUnit\Framework\MockObject\MockObject $config */ - $config = $this->getMockBuilder(IConfig::class) - ->disableOriginalConstructor() - ->getMock(); - $config->expects($this->any()) - ->method('getSystemValue') - ->willReturnMap([ - ['dbname', 'owncloud', 'testDB'], - ['dbtableprefix', 'oc_', 'test_'] - ]); - return $config; - } - - public function testRead() { - $reader = new MDB2SchemaReader($this->getConfig(), new MySQLPlatform()); - $schema = $reader->loadSchemaFromFile(__DIR__ . '/testschema.xml', new Schema()); - $this->assertCount(1, $schema->getTables()); - - $table = $schema->getTable('test_table'); - $this->assertCount(9, $table->getColumns()); - - $this->assertEquals(4, $table->getColumn('id')->getLength()); - $this->assertTrue($table->getColumn('id')->getAutoincrement()); - $this->assertEquals(0, $table->getColumn('id')->getDefault()); - $this->assertTrue($table->getColumn('id')->getNotnull()); - $this->assertInstanceOf(IntegerType::class, $table->getColumn('id')->getType()); - - $this->assertSame(10, $table->getColumn('integerfield_default')->getDefault()); - - $this->assertEquals(32, $table->getColumn('textfield')->getLength()); - $this->assertFalse($table->getColumn('textfield')->getAutoincrement()); - $this->assertSame('foo', $table->getColumn('textfield')->getDefault()); - $this->assertTrue($table->getColumn('textfield')->getNotnull()); - $this->assertInstanceOf(StringType::class, $table->getColumn('textfield')->getType()); - - $this->assertNull($table->getColumn('clobfield')->getLength()); - $this->assertFalse($table->getColumn('clobfield')->getAutoincrement()); - $this->assertNull($table->getColumn('clobfield')->getDefault()); - $this->assertFalse($table->getColumn('clobfield')->getNotnull()); - $this->assertInstanceOf(StringType::class, $table->getColumn('clobfield')->getType()); -// $this->assertInstanceOf(TextType::class, $table->getColumn('clobfield')->getType()); - - $this->assertNull($table->getColumn('booleanfield')->getLength()); - $this->assertFalse($table->getColumn('booleanfield')->getAutoincrement()); - $this->assertNull($table->getColumn('booleanfield')->getDefault()); - $this->assertInstanceOf(BooleanType::class, $table->getColumn('booleanfield')->getType()); - - $this->assertTrue($table->getColumn('booleanfield_true')->getDefault()); - $this->assertFalse($table->getColumn('booleanfield_false')->getDefault()); - - $this->assertEquals(12, $table->getColumn('decimalfield_precision_scale')->getPrecision()); - $this->assertEquals(2, $table->getColumn('decimalfield_precision_scale')->getScale()); - - $this->assertCount(3, $table->getIndexes()); - $this->assertEquals(['id'], $table->getIndex('primary')->getUnquotedColumns()); - $this->assertTrue($table->getIndex('primary')->isPrimary()); - $this->assertTrue($table->getIndex('primary')->isUnique()); - $this->assertEquals(['integerfield'], $table->getIndex('index_integerfield')->getUnquotedColumns()); - $this->assertFalse($table->getIndex('index_integerfield')->isPrimary()); - $this->assertTrue($table->getIndex('index_integerfield')->isUnique()); - $this->assertEquals(['booleanfield'], $table->getIndex('index_boolean')->getUnquotedColumns()); - $this->assertFalse($table->getIndex('index_boolean')->isPrimary()); - $this->assertFalse($table->getIndex('index_boolean')->isUnique()); - } -} diff --git a/tests/lib/DB/MigratorTest.php b/tests/lib/DB/MigratorTest.php index 12ff3bd0749..1d2afaa405e 100644 --- a/tests/lib/DB/MigratorTest.php +++ b/tests/lib/DB/MigratorTest.php @@ -12,9 +12,15 @@ namespace Test\DB; use Doctrine\DBAL\Exception; use Doctrine\DBAL\Platforms\MySQLPlatform; use Doctrine\DBAL\Platforms\OraclePlatform; +use Doctrine\DBAL\Platforms\PostgreSQL94Platform; use Doctrine\DBAL\Platforms\SqlitePlatform; use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\SchemaConfig; +use OC\DB\Migrator; +use OC\DB\MySQLMigrator; +use OC\DB\OracleMigrator; +use OC\DB\PostgreSqlMigrator; +use OC\DB\SQLiteMigrator; use OCP\IConfig; /** @@ -31,11 +37,6 @@ class MigratorTest extends \Test\TestCase { private $connection; /** - * @var \OC\DB\MDB2SchemaManager - */ - private $manager; - - /** * @var IConfig **/ private $config; @@ -54,11 +55,27 @@ class MigratorTest extends \Test\TestCase { if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) { $this->markTestSkipped('DB migration tests are not supported on OCI'); } - $this->manager = new \OC\DB\MDB2SchemaManager($this->connection); + $this->tableName = $this->getUniqueTableName(); $this->tableNameTmp = $this->getUniqueTableName(); } + private function getMigrator(): Migrator { + $platform = $this->connection->getDatabasePlatform(); + $random = \OC::$server->getSecureRandom(); + $dispatcher = \OC::$server->getEventDispatcher(); + if ($platform instanceof SqlitePlatform) { + return new SQLiteMigrator($this->connection, $this->config, $dispatcher); + } elseif ($platform instanceof OraclePlatform) { + return new OracleMigrator($this->connection, $this->config, $dispatcher); + } elseif ($platform instanceof MySQLPlatform) { + return new MySQLMigrator($this->connection, $this->config, $dispatcher); + } elseif ($platform instanceof PostgreSQL94Platform) { + return new PostgreSqlMigrator($this->connection, $this->config, $dispatcher); + } + return new Migrator($this->connection, $this->config, $dispatcher); + } + private function getUniqueTableName() { return strtolower($this->getUniqueID($this->config->getSystemValue('dbtableprefix', 'oc_') . 'test_')); } @@ -132,7 +149,7 @@ class MigratorTest extends \Test\TestCase { public function testUpgrade() { [$startSchema, $endSchema] = $this->getDuplicateKeySchemas(); - $migrator = $this->manager->getMigrator(); + $migrator = $this->getMigrator(); $migrator->migrate($startSchema); $this->connection->insert($this->tableName, ['id' => 1, 'name' => 'foo']); @@ -150,7 +167,7 @@ class MigratorTest extends \Test\TestCase { $this->tableName = strtolower($this->getUniqueID($this->config->getSystemValue('dbtableprefix') . 'test_')); [$startSchema, $endSchema] = $this->getDuplicateKeySchemas(); - $migrator = $this->manager->getMigrator(); + $migrator = $this->getMigrator(); $migrator->migrate($startSchema); $this->connection->insert($this->tableName, ['id' => 1, 'name' => 'foo']); @@ -165,7 +182,7 @@ class MigratorTest extends \Test\TestCase { public function testInsertAfterUpgrade() { [$startSchema, $endSchema] = $this->getDuplicateKeySchemas(); - $migrator = $this->manager->getMigrator(); + $migrator = $this->getMigrator(); $migrator->migrate($startSchema); $migrator->migrate($endSchema); @@ -192,7 +209,7 @@ class MigratorTest extends \Test\TestCase { $table->addColumn('name', 'string'); $table->setPrimaryKey(['id']); - $migrator = $this->manager->getMigrator(); + $migrator = $this->getMigrator(); $migrator->migrate($startSchema); $migrator->migrate($endSchema); @@ -213,7 +230,7 @@ class MigratorTest extends \Test\TestCase { $table->addColumn('user', 'string', ['length' => 64]); $table->setPrimaryKey(['id']); - $migrator = $this->manager->getMigrator(); + $migrator = $this->getMigrator(); $migrator->migrate($startSchema); $migrator->migrate($endSchema); @@ -234,7 +251,7 @@ class MigratorTest extends \Test\TestCase { $tableFk->addColumn('name', 'string'); $tableFk->addForeignKeyConstraint($this->tableName, ['fk_id'], ['id'], [], $fkName); - $migrator = $this->manager->getMigrator(); + $migrator = $this->getMigrator(); $migrator->migrate($startSchema); diff --git a/tests/lib/DB/MySqlMigrationTest.php b/tests/lib/DB/MySqlMigrationTest.php deleted file mode 100644 index 38cb64916ec..00000000000 --- a/tests/lib/DB/MySqlMigrationTest.php +++ /dev/null @@ -1,48 +0,0 @@ -<?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 MySqlMigration - * - * @group DB - */ -class MySqlMigrationTest extends \Test\TestCase { - - /** @var \Doctrine\DBAL\Connection */ - private $connection; - - /** @var string */ - private $tableName; - - protected function setUp(): void { - parent::setUp(); - - $this->connection = \OC::$server->get(\OC\DB\Connection::class); - if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) { - $this->markTestSkipped("Test only relevant on MySql"); - } - - $dbPrefix = \OC::$server->getConfig()->getSystemValue("dbtableprefix"); - $this->tableName = $this->getUniqueID($dbPrefix . '_enum_bit_test'); - $this->connection->exec("CREATE TABLE $this->tableName(b BIT, e ENUM('1','2','3','4'))"); - } - - protected function tearDown(): void { - $this->connection->getSchemaManager()->dropTable($this->tableName); - parent::tearDown(); - } - - public function testNonOCTables() { - $manager = new \OC\DB\MDB2SchemaManager($this->connection); - $manager->updateDbFromStructure(__DIR__ . '/testschema.xml'); - - $this->addToAssertionCount(1); - } -} diff --git a/tests/lib/DB/SchemaDiffTest.php b/tests/lib/DB/SchemaDiffTest.php deleted file mode 100644 index 0e5612e3b3b..00000000000 --- a/tests/lib/DB/SchemaDiffTest.php +++ /dev/null @@ -1,108 +0,0 @@ -<?php -/** - * @author Thomas Müller <thomas.mueller@tmit.eu> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace Test\DB; - -use Doctrine\DBAL\Schema\Schema; -use Doctrine\DBAL\Schema\SchemaDiff; -use OC\DB\MDB2SchemaManager; -use OC\DB\MDB2SchemaReader; -use OCP\IConfig; -use OCP\IDBConnection; -use Test\TestCase; - -/** - * Class MigratorTest - * - * @group DB - * - * @package Test\DB - */ -class SchemaDiffTest extends TestCase { - /** @var IDBConnection $connection */ - private $connection; - /** @var \Doctrine\DBAL\Connection $connection */ - private $internalConnection; - - /** @var MDB2SchemaManager */ - private $manager; - - /** @var IConfig */ - private $config; - - /** @var string */ - private $testPrefix; - - private $schemaFile; - - protected function setUp(): void { - parent::setUp(); - - $this->schemaFile = \OC::$server->getTempManager()->getTemporaryFile(); - - $this->config = \OC::$server->getConfig(); - $this->connection = \OC::$server->getDatabaseConnection(); - $this->internalConnection = \OC::$server->get(\OC\DB\Connection::class); - $this->manager = new MDB2SchemaManager($this->internalConnection); - $this->testPrefix = strtolower($this->getUniqueID($this->config->getSystemValue('dbtableprefix', 'oc_'), 3)); - } - - protected function tearDown(): void { - $this->manager->removeDBStructure($this->schemaFile); - parent::tearDown(); - } - - /** - * @dataProvider providesSchemaFiles - * @param string $xml - */ - public function testZeroChangeOnSchemaMigrations($xml) { - $xml = str_replace('*dbprefix*', $this->testPrefix, $xml); - $schemaFile = $this->schemaFile; - file_put_contents($schemaFile, $xml); - - // apply schema - $this->manager->createDbFromStructure($schemaFile); - - $schemaReader = new MDB2SchemaReader($this->config, $this->connection->getDatabasePlatform()); - $toSchema = new Schema([], [], $this->internalConnection->getSchemaManager()->createSchemaConfig()); - $endSchema = $schemaReader->loadSchemaFromFile($schemaFile, $toSchema); - - // get the diff - /** @var SchemaDiff $diff */ - $migrator = $this->manager->getMigrator(); - $diff = $this->invokePrivate($migrator, 'getDiff', [$endSchema, $this->internalConnection]); - - // no sql statement is expected - $sqls = $diff->toSql($this->connection->getDatabasePlatform()); - $this->assertEmpty($sqls); - } - - public function providesSchemaFiles() { - return [ - 'explicit test on autoincrement' => [file_get_contents(__DIR__ . '/schemDiffData/autoincrement.xml')], - 'explicit test on clob' => [file_get_contents(__DIR__ . '/schemDiffData/clob.xml')], - 'explicit test on unsigned' => [file_get_contents(__DIR__ . '/schemDiffData/unsigned.xml')], - 'explicit test on default -1' => [file_get_contents(__DIR__ . '/schemDiffData/default-1.xml')], - 'testing core schema' => [file_get_contents(__DIR__ . '/schemDiffData/core.xml')], - ]; - } -} diff --git a/tests/lib/DB/SqliteMigrationTest.php b/tests/lib/DB/SqliteMigrationTest.php deleted file mode 100644 index b0bf39b4035..00000000000 --- a/tests/lib/DB/SqliteMigrationTest.php +++ /dev/null @@ -1,48 +0,0 @@ -<?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 SqliteMigration - * - * @group DB - */ -class SqliteMigrationTest extends \Test\TestCase { - - /** @var \Doctrine\DBAL\Connection */ - private $connection; - - /** @var string */ - private $tableName; - - protected function setUp(): void { - parent::setUp(); - - $this->connection = \OC::$server->get(\OC\DB\Connection::class); - if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) { - $this->markTestSkipped("Test only relevant on Sqlite"); - } - - $dbPrefix = \OC::$server->getConfig()->getSystemValue("dbtableprefix"); - $this->tableName = $this->getUniqueID($dbPrefix . '_enum_bit_test'); - $this->connection->prepare("CREATE TABLE $this->tableName(t0 tinyint unsigned, t1 tinyint)")->execute(); - } - - protected function tearDown(): void { - $this->connection->getSchemaManager()->dropTable($this->tableName); - parent::tearDown(); - } - - public function testNonOCTables() { - $manager = new \OC\DB\MDB2SchemaManager($this->connection); - $manager->updateDbFromStructure(__DIR__ . '/testschema.xml'); - - $this->addToAssertionCount(1); - } -} diff --git a/tests/lib/DB/schemDiffData/autoincrement.xml b/tests/lib/DB/schemDiffData/autoincrement.xml deleted file mode 100644 index 458c5d8166f..00000000000 --- a/tests/lib/DB/schemDiffData/autoincrement.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<database> - <table> - <name>*dbprefix*external_config</name> - <declaration> - <field> - <name>config_id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>6</length> - </field> - </declaration> - </table> -</database> diff --git a/tests/lib/DB/schemDiffData/clob.xml b/tests/lib/DB/schemDiffData/clob.xml deleted file mode 100644 index 08aef18c31d..00000000000 --- a/tests/lib/DB/schemDiffData/clob.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<database> - <table> - <name>*dbprefix*external_config</name> - <declaration> - <field> - <name>value</name> - <type>text</type> - <notnull>true</notnull> - <length>100000</length> - </field> - </declaration> - </table> -</database> diff --git a/tests/lib/DB/schemDiffData/core.xml b/tests/lib/DB/schemDiffData/core.xml deleted file mode 100644 index d7edc7dc73e..00000000000 --- a/tests/lib/DB/schemDiffData/core.xml +++ /dev/null @@ -1,1347 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<database> - - <table> - - <!-- - Namespaced Key-Value Store for Application Configuration. - - Keys are namespaced per appid. - - E.g. (core, global_cache_gc_lastrun) -> 1385463286 - --> - <name>*dbprefix*appconfig</name> - - <declaration> - - <field> - <name>appid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>32</length> - </field> - - <field> - <name>configkey</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>configvalue</name> - <type>clob</type> - <notnull>false</notnull> - </field> - </declaration> - - </table> - - <table> - - <!-- - Bidirectional Map for Storage Names and Storage Ids. - - Assigns each storage name a unique storage id integer. - - Long storage names are hashed. - - E.g. local::/tmp/ <-> 2 - - E.g. b5db994aa8c6625100e418406c798269 <-> 27 - --> - <name>*dbprefix*storages</name> - - <declaration> - - <field> - <name>id</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>64</length> - </field> - - <field> - <name>numeric_id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>4</length> - </field> - - <field> - <name>available</name> - <type>integer</type> - <default>1</default> - <notnull>true</notnull> - </field> - - <field> - <name>last_checked</name> - <type>integer</type> - </field> - </declaration> - - </table> - - <!-- a list of all mounted storage per user, populated on filesystem setup --> - <table> - - <name>*dbprefix*mounts</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>4</length> - </field> - - <field> - <name>storage_id</name> - <type>integer</type> - <notnull>true</notnull> - </field> - - <!-- fileid of the root of the mount, foreign key: oc_filecache.fileid --> - <field> - <name>root_id</name> - <type>integer</type> - <notnull>true</notnull> - </field> - - <field> - <name>user_id</name> - <type>text</type> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>mount_point</name> - <type>text</type> - <notnull>true</notnull> - <length>4000</length> - </field> - - - </declaration> - - </table> - - <table> - - <!-- - Bidirectional Map for Mimetypes and Mimetype Id - - Assigns each mimetype (and supertype) a unique mimetype id integer. - - E.g. application <-> 5 - - E.g. application/pdf <-> 6 - --> - <name>*dbprefix*mimetypes</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>4</length> - </field> - - <field> - <name>mimetype</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - </declaration> - - </table> - - <table> - - <!-- - Main file table containing one row for each directory and file. - - Assigns a unique integer fileid to each file (and directory) - - Assigns an etag to each file (and directory) - - Caches various file/dir properties such as: - - path (filename, e.g. files/combinatoricslib-2.0_doc.zip) - - path_hash = md5(path) - - name (basename, e.g. combinatoricslib-2.0_doc.zip) - - size (for directories this is the sum of all contained file sizes) - --> - <name>*dbprefix*filecache</name> - - <declaration> - - <field> - <name>fileid</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>4</length> - </field> - - <!-- Foreign Key storages::numeric_id --> - <field> - <name>storage</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>path</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>4000</length> - </field> - - <field> - <name>path_hash</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>32</length> - </field> - - <!-- Foreign Key filecache::fileid --> - <field> - <name>parent</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>name</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>250</length> - </field> - - <!-- Foreign Key mimetypes::id --> - <field> - <name>mimetype</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>4</length> - </field> - - <!-- Foreign Key mimetypes::id --> - <field> - <name>mimepart</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>size</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>8</length> - </field> - - <field> - <name>mtime</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>storage_mtime</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>encrypted</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>unencrypted_size</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>8</length> - </field> - - <field> - <name>etag</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>40</length> - </field> - - <field> - <name>permissions</name> - <type>integer</type> - <default>0</default> - <notnull>false</notnull> - <length>4</length> - </field> - - <field> - <name>checksum</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>255</length> - </field> - - - - </declaration> - - </table> - - <table> - - <!-- - Stores which groups have which users as members in an n:m relationship. - - Maps group id (gid) to a set of users (uid) - - Maps user id (uid) to a set of groups (gid) (but without index) - --> - <name>*dbprefix*group_user</name> - - <declaration> - - <!-- Foreign Key groups::gid --> - <field> - <name>gid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <!-- Foreign Key users::uid --> - <field> - <name>uid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - </declaration> - - </table> - - <table> - - <!-- - Stores which groups have which users as admins in an n:m relationship. - - Maps group id (gid) to a set of users (uid) - - Maps user id (uid) to a set of groups (gid) - - NOTE: This could (very likely) be reduced to a single bit in group_user - instead of repeating varchars gid and uid here - --> - <name>*dbprefix*group_admin</name> - - <declaration> - - <!-- Foreign Key groups::gid --> - <field> - <name>gid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <!-- Foreign Key users::uid --> - <field> - <name>uid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - </declaration> - - </table> - - <table> - - <!-- - A simple list of groups. - --> - <name>*dbprefix*groups</name> - - <declaration> - - <field> - <name>gid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - </declaration> - - </table> - - <table> - - <!-- - Namespaced Key-Value Store for User Preferences - - Keys are namespaced per userid and appid. - - E.g. (admin, files, cache_version) -> 5 - --> - <name>*dbprefix*preferences</name> - - <declaration> - - <!-- Foreign Key users::uid --> - <field> - <name>userid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>appid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>32</length> - </field> - - <field> - <name>configkey</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>configvalue</name> - <type>clob</type> - <notnull>false</notnull> - </field> - - </declaration> - - </table> - - <table> - - <!-- - WebDAV properties. - --> - <name>*dbprefix*properties</name> - - <declaration> - - <field> - <name>id</name> - <autoincrement>1</autoincrement> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>4</length> - </field> - - <!-- Foreign Key users::uid --> - <field> - <name>userid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>propertypath</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <field> - <name>propertyname</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <field> - <name>propertyvalue</name> - <type>text</type> - <notnull>true</notnull> - <length>255</length> - </field> - - </declaration> - - </table> - - <table> - - <!-- - Shares of all types (user-to-user, external-via-link, etc.) - --> - <name>*dbprefix*share</name> - - <declaration> - - <field> - <name>id</name> - <autoincrement>1</autoincrement> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>4</length> - </field> - - <!-- Constant OCP\Share\IShare::TYPE_* --> - <field> - <name>share_type</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>1</length> - </field> - - <!-- Foreign Key users::uid or NULL --> - <field> - <name>share_with</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>255</length> - </field> - - <!-- Foreign Key users::uid --> - <!-- This is the owner of the share - which does not have to be the initiator of the share --> - <field> - <name>uid_owner</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <!-- Foreign Key users::uid --> - <!-- This is the initiator of the share --> - <field> - <name>uid_initiator</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>64</length> - </field> - - - - <!-- Foreign Key share::id or NULL --> - <field> - <name>parent</name> - <type>integer</type> - <notnull>false</notnull> - <length>4</length> - </field> - - <!-- E.g. file or folder --> - <field> - <name>item_type</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <!-- Foreign Key filecache::fileid --> - <field> - <name>item_source</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>255</length> - </field> - - <field> - <name>item_target</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>255</length> - </field> - - <!-- Foreign Key filecache::fileid --> - <field> - <name>file_source</name> - <type>integer</type> - <notnull>false</notnull> - <length>4</length> - </field> - - <field> - <name>file_target</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>512</length> - </field> - - <!-- Permission bitfield --> - <field> - <name>permissions</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>1</length> - </field> - - <!-- Time of share creation --> - <field> - <name>stime</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>8</length> - </field> - - <!-- Whether the receiver accepted the share, if share_with is set. --> - <field> - <name>accepted</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>1</length> - </field> - - <!-- Time of share expiration --> - <field> - <name>expiration</name> - <type>timestamp</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <name>token</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>32</length> - </field> - - <field> - <name>mail_send</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>1</length> - </field> - - </declaration> - - </table> - - <table> - - <!-- - Scheduled background jobs. - See OC\BackgroundJob\JobList. - --> - <name>*dbprefix*jobs</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <field> - <name>class</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <field> - <name>argument</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>4000</length> - </field> - - <field> - <!-- timestamp when the job was executed the last time --> - <name>last_run</name> - <type>integer</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <!-- timestamp when the job was checked if it needs execution the last time --> - <name>last_checked</name> - <type>integer</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <!-- timestamp when the job was reserved the last time, 1 day timeout --> - <name>reserved_at</name> - <type>integer</type> - <default></default> - <notnull>false</notnull> - </field> - - </declaration> - - </table> - - <table> - - <!-- - List of usernames, their display name and login password. - --> - <name>*dbprefix*users</name> - - <declaration> - - <field> - <name>uid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>displayname</name> - <type>text</type> - <default></default> - <length>64</length> - </field> - - <field> - <name>password</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - - </declaration> - - </table> - - <table> - <name>*dbprefix*authtoken</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <!-- Foreign Key users::uid --> - <field> - <name>uid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>login_name</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>password</name> - <type>clob</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <name>name</name> - <type>clob</type> - <default></default> - <notnull>true</notnull> - </field> - - <field> - <name>token</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>200</length> - </field> - - <field> - <name>type</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>2</length> - </field> - - <field> - <name>last_activity</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - </field> - - </declaration> - </table> - - <table> - - <!-- - List of tags (category) + a unique tag id (id) per user (uid) and type. - --> - <name>*dbprefix*vcategory</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <!-- Foreign Key users::uid --> - <field> - <name>uid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>type</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>category</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - </declaration> - </table> - - <table> - - <!-- - Object-Tag associations per tag type. - --> - <name>*dbprefix*vcategory_to_object</name> - - <declaration> - - <field> - <name>objid</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <!-- Foreign Key vcategory::id --> - <field> - <name>categoryid</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <field> - <name>type</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - </declaration> - - </table> - - <table> - <!-- - List of system-wide tags - --> - <name>*dbprefix*systemtag</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <!-- Tag name --> - <field> - <name>name</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <!-- Visibility: 0 user-not-visible, 1 user-visible --> - <field> - <name>visibility</name> - <type>integer</type> - <default>1</default> - <notnull>true</notnull> - <length>1</length> - </field> - - <!-- Editable: 0 user-not-editable, 1 user-editable --> - <field> - <name>editable</name> - <type>integer</type> - <default>1</default> - <notnull>true</notnull> - <length>1</length> - </field> - - </declaration> - </table> - - <table> - - <!-- - System tag to object associations per object type. - --> - <name>*dbprefix*systemtag_object_mapping</name> - - <declaration> - - <!-- object id (ex: file id for files)--> - <field> - <name>objectid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <!-- object type (ex: "files")--> - <field> - <name>objecttype</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <!-- Foreign Key systemtag::id --> - <field> - <name>systemtagid</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - </field> - - - </declaration> - - </table> - - <table> - - <!-- - System tag to group mapping - --> - <name>*dbprefix*systemtag_group</name> - - <declaration> - - <!-- Foreign Key systemtag::id --> - <field> - <name>systemtagid</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <field> - <name>gid</name> - <type>string</type> - <notnull>true</notnull> - </field> - - </declaration> - - </table> - - <table> - - <!-- - Namespaced Key-Value Store for arbitrary data. - - Keys are namespaced per userid and appid. - - E.g. (admin, files, foo) -> bar - --> - <name>*dbprefix*privatedata</name> - - <declaration> - - <field> - <name>keyid</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - <autoincrement>1</autoincrement> - </field> - - <!-- Foreign Key users::uid --> - <field> - <name>user</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>app</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <field> - <name>key</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <field> - <name>value</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - </declaration> - - </table> - - <table> - - <!-- - Table for storing transactional file locking - --> - <name>*dbprefix*file_locks</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - <autoincrement>1</autoincrement> - </field> - - <field> - <name>lock</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>key</name> - <type>text</type> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>ttl</name> - <type>integer</type> - <default>-1</default> - <notnull>true</notnull> - <length>4</length> - </field> - - </declaration> - - </table> - - <table> - <!-- - default place to store comment data - --> - <name>*dbprefix*comments</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - <autoincrement>1</autoincrement> - </field> - - <field> - <name>parent_id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <field> - <name>topmost_parent_id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <field> - <name>children_count</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <field> - <name>actor_type</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>actor_id</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>message</name> - <type>clob</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <name>verb</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>64</length> - </field> - - <field> - <name>creation_timestamp</name> - <type>timestamp</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <name>latest_child_timestamp</name> - <type>timestamp</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <name>object_type</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>object_id</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - </declaration> - - </table> - - <table> - <!-- - default place to store per user and object read markers - --> - <name>*dbprefix*comments_read_markers</name> - - <declaration> - - <field> - <name>user_id</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>marker_datetime</name> - <type>timestamp</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <name>object_type</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>object_id</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - </declaration> - - </table> - - <table> - <!-- - Encrypted credentials storage - --> - <name>*dbprefix*credentials</name> - - <declaration> - - <field> - <name>user</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>64</length> - </field> - - <field> - <name>identifier</name> - <type>text</type> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>credentials</name> - <type>clob</type> - <notnull>false</notnull> - </field> - - </declaration> - - </table> - -</database> diff --git a/tests/lib/DB/schemDiffData/default-1.xml b/tests/lib/DB/schemDiffData/default-1.xml deleted file mode 100644 index 39b95a1f273..00000000000 --- a/tests/lib/DB/schemDiffData/default-1.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<database> - - <table> - - <!-- - Table for storing transactional file locking - --> - <name>*dbprefix*file_locks</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - <autoincrement>1</autoincrement> - </field> - - <field> - <name>lock</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>key</name> - <type>text</type> - <notnull>true</notnull> - <default>(stupid text)</default> - <length>64</length> - </field> - - <field> - <name>ttl</name> - <type>integer</type> - <default>-1</default> - <notnull>true</notnull> - <length>4</length> - </field> - - </declaration> - - </table> - -</database> diff --git a/tests/lib/DB/schemDiffData/unsigned.xml b/tests/lib/DB/schemDiffData/unsigned.xml deleted file mode 100644 index e89fd6a5d4e..00000000000 --- a/tests/lib/DB/schemDiffData/unsigned.xml +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<database> - - <table> - - <!-- - Scheduled background jobs. - See OC\BackgroundJob\JobList. - --> - <name>*dbprefix*jobs</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <field> - <name>class</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <field> - <name>argument</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>4000</length> - </field> - - <field> - <!-- timestamp when the job was executed the last time --> - <name>last_run</name> - <type>integer</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <!-- timestamp when the job was checked if it needs execution the last time --> - <name>last_checked</name> - <type>integer</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <!-- timestamp when the job was reserved the last time, 1 day timeout --> - <name>reserved_at</name> - <type>integer</type> - <default></default> - <notnull>false</notnull> - </field> - - </declaration> - - </table> - -</database> diff --git a/tests/lib/DB/testschema.xml b/tests/lib/DB/testschema.xml deleted file mode 100644 index a2b01d8259e..00000000000 --- a/tests/lib/DB/testschema.xml +++ /dev/null @@ -1,99 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<database> - - <name>*dbname*</name> - <create>true</create> - <overwrite>false</overwrite> - - <charset>utf8</charset> - - <table> - - <name>*dbprefix*table</name> - - <declaration> - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <primary>true</primary> - <length>4</length> - <autoincrement>1</autoincrement> - </field> - <field> - <name>integerfield</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>4</length> - </field> - <field> - <name>integerfield_default</name> - <type>integer</type> - <default>10</default> - <notnull>true</notnull> - <length>4</length> - </field> - <field> - <name>textfield</name> - <type>text</type> - <default>foo</default> - <notnull>true</notnull> - <length>32</length> - </field> - <field> - <name>clobfield</name> - <type>text</type> - </field> - <field> - <name>booleanfield</name> - <type>boolean</type> - </field> - <field> - <name>booleanfield_true</name> - <type>boolean</type> - <default>true</default> - </field> - <field> - <name>booleanfield_false</name> - <type>boolean</type> - <default>false</default> - </field> - <field> - <name>decimalfield_precision_scale</name> - <type>decimal</type> - <precision>12</precision> - <scale>2</scale> - </field> - - <index> - <name>index_primary</name> - <primary>true</primary> - <unique>true</unique> - <field> - <name>id</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>index_integerfield</name> - <unique>true</unique> - <field> - <name>integerfield</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>index_boolean</name> - <unique>false</unique> - <field> - <name>booleanfield</name> - <sorting>ascending</sorting> - </field> - </index> - </declaration> - </table> -</database> diff --git a/tests/lib/DB/ts-autoincrement-after.xml b/tests/lib/DB/ts-autoincrement-after.xml deleted file mode 100644 index d4445f1e247..00000000000 --- a/tests/lib/DB/ts-autoincrement-after.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<database> - - <name>*dbname*</name> - <create>true</create> - <overwrite>false</overwrite> - - <charset>utf8</charset> - - <table> - - <name>*dbprefix*table</name> - - <declaration> - <field> - <name>auto_id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>4</length> - </field> - <field> - <name>textfield</name> - <type>text</type> - <default>foo</default> - <notnull>true</notnull> - <length>32</length> - </field> - </declaration> - </table> -</database> diff --git a/tests/lib/DB/ts-autoincrement-before.xml b/tests/lib/DB/ts-autoincrement-before.xml deleted file mode 100644 index 412739e9a71..00000000000 --- a/tests/lib/DB/ts-autoincrement-before.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<database> - - <name>*dbname*</name> - <create>true</create> - <overwrite>false</overwrite> - - <charset>utf8</charset> - - <table> - - <name>*dbprefix*table</name> - - <declaration> - <field> - <name>textfield</name> - <type>text</type> - <default>foo</default> - <notnull>true</notnull> - <length>32</length> - </field> - </declaration> - </table> -</database> |