]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions-functions.php
Code improved:
[mailer.git] / inc / extensions-functions.php
index fb7139553670570c1e595c1e5be71bc3bd9d545c..a2222b2655eea62fe5bb863fe9fc9f19575f66d8 100644 (file)
@@ -1853,6 +1853,19 @@ function addDropTableSql ($tableName) {
        } // END - if
 }
 
+// Adds a RENAME TABLE stament if 'from' table exist and 'to' table not
+function addRenameTableSql ($fromTable, $toTable) {
+       // Is renaming required?
+       if ((ifSqlTableExists($fromTable)) && (!ifSqlTableExists($toTable))) {
+               // Add it
+               addExtensionSql('RENAME TABLE `{?_MYSQL_PREFIX?}_' . $fromTable . '` TO `{?_MYSQL_PREFIX?}_' . $toTable . '`');
+
+               // Mark both tables
+               $GLOBALS['ifSqlTableExists'][$fromTable] = false;
+               $GLOBALS['ifSqlTableExists'][$toTable]   = true;
+       } // END - if
+}
+
 // Adds an admin menu to the SQL queue of the menu entry is not found
 function addAdminMenuSql ($action, $what, $title, $descr, $sort) {
        // Now check if this menu is there