mirror of
https://github.com/nextcloud/server.git
synced 2024-08-14 14:10:40 +02:00
fix(mysql): Remove custom MySQL workaround from 2015
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
b202b139dd
commit
160298c556
@ -1194,7 +1194,6 @@ return array(
|
||||
'OC\\DB\\MissingColumnInformation' => $baseDir . '/lib/private/DB/MissingColumnInformation.php',
|
||||
'OC\\DB\\MissingIndexInformation' => $baseDir . '/lib/private/DB/MissingIndexInformation.php',
|
||||
'OC\\DB\\MissingPrimaryKeyInformation' => $baseDir . '/lib/private/DB/MissingPrimaryKeyInformation.php',
|
||||
'OC\\DB\\MySQLMigrator' => $baseDir . '/lib/private/DB/MySQLMigrator.php',
|
||||
'OC\\DB\\MySqlTools' => $baseDir . '/lib/private/DB/MySqlTools.php',
|
||||
'OC\\DB\\OCSqlitePlatform' => $baseDir . '/lib/private/DB/OCSqlitePlatform.php',
|
||||
'OC\\DB\\ObjectParameter' => $baseDir . '/lib/private/DB/ObjectParameter.php',
|
||||
|
@ -1227,7 +1227,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
|
||||
'OC\\DB\\MissingColumnInformation' => __DIR__ . '/../../..' . '/lib/private/DB/MissingColumnInformation.php',
|
||||
'OC\\DB\\MissingIndexInformation' => __DIR__ . '/../../..' . '/lib/private/DB/MissingIndexInformation.php',
|
||||
'OC\\DB\\MissingPrimaryKeyInformation' => __DIR__ . '/../../..' . '/lib/private/DB/MissingPrimaryKeyInformation.php',
|
||||
'OC\\DB\\MySQLMigrator' => __DIR__ . '/../../..' . '/lib/private/DB/MySQLMigrator.php',
|
||||
'OC\\DB\\MySqlTools' => __DIR__ . '/../../..' . '/lib/private/DB/MySqlTools.php',
|
||||
'OC\\DB\\OCSqlitePlatform' => __DIR__ . '/../../..' . '/lib/private/DB/OCSqlitePlatform.php',
|
||||
'OC\\DB\\ObjectParameter' => __DIR__ . '/../../..' . '/lib/private/DB/ObjectParameter.php',
|
||||
|
@ -599,8 +599,6 @@ class Connection extends \Doctrine\DBAL\Connection {
|
||||
return new SQLiteMigrator($this, $config, $dispatcher);
|
||||
} elseif ($platform instanceof OraclePlatform) {
|
||||
return new OracleMigrator($this, $config, $dispatcher);
|
||||
} elseif ($platform instanceof MySQLPlatform) {
|
||||
return new MySQLMigrator($this, $config, $dispatcher);
|
||||
} else {
|
||||
return new Migrator($this, $config, $dispatcher);
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
||||
*
|
||||
* @author Robin Appelman <robin@icewind.nl>
|
||||
* @author Thomas Müller <thomas.mueller@tmit.eu>
|
||||
*
|
||||
* @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 OC\DB;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
||||
class MySQLMigrator extends Migrator {
|
||||
/**
|
||||
* @param Schema $targetSchema
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
* @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
|
||||
foreach ($schemaDiff->changedTables as $tableDiff) {
|
||||
$tableDiff->name = $this->connection->quoteIdentifier($tableDiff->name);
|
||||
foreach ($tableDiff->changedColumns as $column) {
|
||||
$column->oldColumnName = $this->connection->quoteIdentifier($column->oldColumnName);
|
||||
}
|
||||
}
|
||||
|
||||
return $schemaDiff;
|
||||
}
|
||||
}
|
@ -11,13 +11,11 @@ namespace Test\DB;
|
||||
|
||||
use Doctrine\DBAL\Exception;
|
||||
use Doctrine\DBAL\ParameterType;
|
||||
use Doctrine\DBAL\Platforms\MySQLPlatform;
|
||||
use Doctrine\DBAL\Platforms\OraclePlatform;
|
||||
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\SQLiteMigrator;
|
||||
use OCP\DB\Types;
|
||||
@ -65,8 +63,6 @@ class MigratorTest extends \Test\TestCase {
|
||||
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);
|
||||
}
|
||||
return new Migrator($this->connection, $this->config, $dispatcher);
|
||||
}
|
||||
@ -138,10 +134,6 @@ class MigratorTest extends \Test\TestCase {
|
||||
return $this->connection->getDatabasePlatform() instanceof SqlitePlatform;
|
||||
}
|
||||
|
||||
private function isMySQL() {
|
||||
return $this->connection->getDatabasePlatform() instanceof MySQLPlatform;
|
||||
}
|
||||
|
||||
public function testUpgrade() {
|
||||
[$startSchema, $endSchema] = $this->getDuplicateKeySchemas();
|
||||
$migrator = $this->getMigrator();
|
||||
|
Loading…
Reference in New Issue
Block a user