[BUGFIX] DBAL: Fix renaming of tables in Install Tool 24/45124/2
authorMorton Jonuschat <m.jonuschat@mojocode.de>
Fri, 4 Dec 2015 09:51:55 +0000 (10:51 +0100)
committerMorton Jonuschat <m.jonuschat@mojocode.de>
Fri, 4 Dec 2015 11:53:39 +0000 (12:53 +0100)
Add handling of the RENAME action to compileALTERTABLE() to allow the
InstallTool to rename a table before suggesting to drop it permanently.

Resolves: #72036
Releases: master
Change-Id: Ie0886594b09e9b3fc19e6c68ecdbc1dcaeeae46b
Reviewed-on: https://review.typo3.org/45124
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
typo3/sysext/dbal/Classes/Database/DatabaseConnection.php
typo3/sysext/dbal/Classes/Database/SqlCompilers/Adodb.php

index efbcc71..78cb47c 100644 (file)
@@ -3040,6 +3040,9 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection
                         $result = $this->exec_TRUNCATEquery($this->lastParsedAndMappedQueryArray['TABLE']);
                         break;
                     default:
+                        if (!is_array($compiledQuery)) {
+                            $compiledQuery = array($compiledQuery);
+                        }
                         $result = $this->handlerInstance[$this->lastHandlerKey]->DataDictionary->ExecuteSQLArray($compiledQuery);
                 }
                 break;
index b47de60..eab44ba 100644 (file)
@@ -109,6 +109,9 @@ class Adodb extends AbstractCompiler
             case 'CHANGE':
                 $query = $this->databaseConnection->handlerInstance[$this->databaseConnection->lastHandlerKey]->DataDictionary->AlterColumnSQL($tableName, $fieldName . ' ' . $this->compileFieldCfg($components['definition']));
                 break;
+            case 'RENAME':
+                $query = $this->databaseConnection->handlerInstance[$this->databaseConnection->lastHandlerKey]->DataDictionary->RenameTableSQL($tableName, $fieldName);
+                break;
             case 'DROP':
 
             case 'DROPKEY':