]> source.dussan.org Git - nextcloud-server.git/commitdiff
Better unique names for temporary tables
authorRobin Appelman <icewind@owncloud.com>
Tue, 3 Jun 2014 09:24:31 +0000 (11:24 +0200)
committerRobin Appelman <icewind@owncloud.com>
Tue, 3 Jun 2014 09:24:31 +0000 (11:24 +0200)
lib/private/db/migrator.php
lib/private/db/oraclemigrator.php

index 5dd7735dfc60812a01b88d0dadeb5536b552eecf..517be8399e86a1c4d832c5f25c45bb01f5328100 100644 (file)
@@ -77,6 +77,16 @@ class Migrator {
                }
        }
 
+       /**
+        * Create a unique name for the temporary table
+        *
+        * @param string $name
+        * @return string
+        */
+       protected function generateTemporaryTableName($name) {
+               return 'oc_' . $name . '_' . uniqid();
+       }
+
        /**
         * Check the migration of a table on a copy so we can detect errors before messing with the real table
         *
@@ -85,7 +95,7 @@ class Migrator {
         */
        protected function checkTableMigrate(Table $table) {
                $name = $table->getName();
-               $tmpName = 'oc_' . uniqid();
+               $tmpName = $this->generateTemporaryTableName($name);
 
                $this->copyTable($name, $tmpName);
 
index de4348bd56dff9709bbd1b9006a46b077dbd2c11..1a8df2def9c9de165c3e7c7d90764c6515a59fb7 100644 (file)
@@ -29,4 +29,12 @@ class OracleMigrator extends NoCheckMigrator {
 
                return $schemaDiff;
        }
+
+       /**
+        * @param string $name
+        * @return string
+        */
+       protected function generateTemporaryTableName($name) {
+               return 'oc_' . uniqid();
+       }
 }