aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/db/mysqlmigrator.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-05-06 14:46:59 +0200
committerRobin Appelman <icewind@owncloud.com>2014-06-03 11:18:45 +0200
commitc6053b283046c7db7201d60d341e279032394002 (patch)
treeed6ed658f567ef049089edeffd5a7089893daed9 /lib/private/db/mysqlmigrator.php
parent6f71419f2b0e8e671274ca761e636ebe0a4067b3 (diff)
downloadnextcloud-server-c6053b283046c7db7201d60d341e279032394002.tar.gz
nextcloud-server-c6053b283046c7db7201d60d341e279032394002.zip
Quote identifiers on mysql
Diffstat (limited to 'lib/private/db/mysqlmigrator.php')
-rw-r--r--lib/private/db/mysqlmigrator.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/private/db/mysqlmigrator.php b/lib/private/db/mysqlmigrator.php
new file mode 100644
index 00000000000..97495f52032
--- /dev/null
+++ b/lib/private/db/mysqlmigrator.php
@@ -0,0 +1,32 @@
+<?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 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) {
+ $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;
+ }
+}