summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-07-24 15:36:17 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-07-24 15:36:17 +0200
commitb72a3e5be7b8fc57b210c49111012f9a1d358d9e (patch)
treefc37b84c1a5f46c27375b12bda9886eca1d1529f
parentfa333c02a0807c6e8347dd1c84381c3584997209 (diff)
parent7d60f7a2220d0c7f4dbdd4bdd9d765cfbd64e4ab (diff)
downloadnextcloud-server-b72a3e5be7b8fc57b210c49111012f9a1d358d9e.tar.gz
nextcloud-server-b72a3e5be7b8fc57b210c49111012f9a1d358d9e.zip
Merge pull request #9837 from owncloud/ignore-non-oc-tables-master
Adding test which breaks because bit and/or enum datatypes are used
-rw-r--r--lib/private/db/mysqlmigrator.php4
-rw-r--r--tests/lib/db/migration.php39
2 files changed, 43 insertions, 0 deletions
diff --git a/lib/private/db/mysqlmigrator.php b/lib/private/db/mysqlmigrator.php
index 97495f52032..c0adcdf5df3 100644
--- a/lib/private/db/mysqlmigrator.php
+++ b/lib/private/db/mysqlmigrator.php
@@ -17,6 +17,10 @@ class MySQLMigrator extends Migrator {
* @return \Doctrine\DBAL\Schema\SchemaDiff
*/
protected function getDiff(Schema $targetSchema, \Doctrine\DBAL\Connection $connection) {
+ $platform = $connection->getDatabasePlatform();
+ $platform->registerDoctrineTypeMapping('enum', 'string');
+ $platform->registerDoctrineTypeMapping('bit', 'string');
+
$schemaDiff = parent::getDiff($targetSchema, $connection);
// identifiers need to be quoted for mysql
diff --git a/tests/lib/db/migration.php b/tests/lib/db/migration.php
new file mode 100644
index 00000000000..820a1431f54
--- /dev/null
+++ b/tests/lib/db/migration.php
@@ -0,0 +1,39 @@
+<?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.
+ */
+
+class TestMigration extends \PHPUnit_Framework_TestCase {
+
+ /** @var \Doctrine\DBAL\Connection */
+ private $connection;
+
+ /** @var string */
+ private $tableName;
+
+ public function setUp() {
+ $this->connection = \OC_DB::getConnection();
+ if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) {
+ $this->markTestSkipped("Test only relevant on MySql");
+ }
+
+ $dbPrefix = \OC::$server->getConfig()->getSystemValue("dbtableprefix");
+ $this->tableName = uniqid($dbPrefix . "_enum_bit_test");
+ $this->connection->exec("CREATE TABLE $this->tableName(b BIT, e ENUM('1','2','3','4'))");
+ }
+
+ public function tearDown() {
+ $this->connection->getSchemaManager()->dropTable($this->tableName);
+ }
+
+ public function testNonOCTables() {
+ $manager = new \OC\DB\MDB2SchemaManager($this->connection);
+ $manager->updateDbFromStructure(__DIR__ . '/testschema.xml');
+
+ $this->assertTrue(true);
+ }
+
+}