summaryrefslogtreecommitdiffstats
path: root/lib/private/db
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-03-14 14:32:02 +0100
committerRobin Appelman <icewind@owncloud.com>2014-06-03 11:17:21 +0200
commitbe80dce58564c88aa74fb353ab17793fc7eb37e0 (patch)
tree46840454df8ed853f686f58ef34696a200dddf1f /lib/private/db
parent58c61c833632aec7aa45eb5817fe93b420bad574 (diff)
downloadnextcloud-server-be80dce58564c88aa74fb353ab17793fc7eb37e0.tar.gz
nextcloud-server-be80dce58564c88aa74fb353ab17793fc7eb37e0.zip
Fix temporary schema creation
Diffstat (limited to 'lib/private/db')
-rw-r--r--lib/private/db/migrator.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/private/db/migrator.php b/lib/private/db/migrator.php
index cf95669fb83..63fddd9c28a 100644
--- a/lib/private/db/migrator.php
+++ b/lib/private/db/migrator.php
@@ -47,8 +47,12 @@ class Migrator {
$existingTables = $this->connection->getSchemaManager()->listTableNames();
foreach ($tables as $table) {
+ if (strpos($table->getName(), '.')) {
+ list(, $tableName) = explode('.', $table->getName());
+ } else {
+ $tableName = $table->getName();
+ }
// don't need to check for new tables
- list(, $tableName) = explode('.', $table->getName());
if (array_search($tableName, $existingTables) !== false) {
$this->checkTableMigrate($table);
}
@@ -63,7 +67,7 @@ class Migrator {
*/
protected function checkTableMigrate(Table $table) {
$name = $table->getName();
- $tmpName = uniqid();
+ $tmpName = 'oc_' . uniqid();
$this->copyTable($name, $tmpName);
@@ -94,12 +98,12 @@ class Migrator {
$indexes = $table->getIndexes();
$newIndexes = array();
foreach ($indexes as $index) {
- $indexName = uniqid(); // avoid conflicts in index names
+ $indexName = 'oc_' . uniqid(); // avoid conflicts in index names
$newIndexes[] = new Index($indexName, $index->getColumns(), $index->isUnique(), $index->isPrimary());
}
// foreign keys are not supported so we just set it to an empty array
- return new Table($newName, $table->getColumns(), $indexes, array(), 0, $table->getOptions());
+ return new Table($newName, $table->getColumns(), $newIndexes, array(), 0, $table->getOptions());
}
/**