2014-07-24 14:10:05 +04:00
|
|
|
<?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.
|
|
|
|
*/
|
|
|
|
|
2016-05-18 19:47:54 +03:00
|
|
|
namespace Test\DB;
|
|
|
|
|
2015-11-03 03:52:41 +03:00
|
|
|
/**
|
2016-05-18 19:47:54 +03:00
|
|
|
* Class SqliteMigration
|
2015-11-03 03:52:41 +03:00
|
|
|
*
|
|
|
|
* @group DB
|
|
|
|
*/
|
2016-05-20 16:38:20 +03:00
|
|
|
class SqliteMigrationTest extends \Test\TestCase {
|
2014-07-24 14:10:05 +04:00
|
|
|
|
|
|
|
/** @var \Doctrine\DBAL\Connection */
|
|
|
|
private $connection;
|
|
|
|
|
|
|
|
/** @var string */
|
|
|
|
private $tableName;
|
|
|
|
|
2019-11-21 18:40:38 +03:00
|
|
|
protected function setUp(): void {
|
2014-11-11 01:30:38 +03:00
|
|
|
parent::setUp();
|
|
|
|
|
2016-01-07 12:26:00 +03:00
|
|
|
$this->connection = \OC::$server->getDatabaseConnection();
|
2014-07-25 10:46:43 +04:00
|
|
|
if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
|
|
|
|
$this->markTestSkipped("Test only relevant on Sqlite");
|
2014-07-24 14:10:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
$dbPrefix = \OC::$server->getConfig()->getSystemValue("dbtableprefix");
|
2014-12-02 15:51:36 +03:00
|
|
|
$this->tableName = $this->getUniqueID($dbPrefix . '_enum_bit_test');
|
2014-07-25 10:46:43 +04:00
|
|
|
$this->connection->exec("CREATE TABLE $this->tableName(t0 tinyint unsigned, t1 tinyint)");
|
2014-07-24 14:10:05 +04:00
|
|
|
}
|
|
|
|
|
2019-11-21 18:40:38 +03:00
|
|
|
protected function tearDown(): void {
|
2014-07-24 14:10:05 +04:00
|
|
|
$this->connection->getSchemaManager()->dropTable($this->tableName);
|
2014-11-11 01:30:38 +03:00
|
|
|
parent::tearDown();
|
2014-07-24 14:10:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testNonOCTables() {
|
|
|
|
$manager = new \OC\DB\MDB2SchemaManager($this->connection);
|
|
|
|
$manager->updateDbFromStructure(__DIR__ . '/testschema.xml');
|
|
|
|
|
2018-01-25 13:23:12 +03:00
|
|
|
$this->addToAssertionCount(1);
|
2014-07-24 14:10:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|