Always change column name
[mailer.git] / inc / extensions-functions.php
index 3a4c95efe82b5af7203e74eef869edc2084f821b..9aca9cf4141a34308c0e1864be12ac31ec312c21 100644 (file)
@@ -1910,6 +1910,24 @@ function addConfigAddSql ($columnName, $columnSql) {
        }
 }
 
+// Drop configuration entry if found for actual extension
+function addConfigDropSql ($columnName) {
+       // Is the column there?
+       if (isSqlTableColumnFound('{?_MYSQL_PREFIX?}_config', $columnName)) {
+               // Found, so add it
+               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `' . $columnName . '`');
+       } else {
+               // Add debug line, debug_report_bug() would cause some extenion updates fail
+               logDebugMessage(__FUNCTION__, __LINE__, 'Configuration entry ' . $columnName . ' not found.');
+       }
+}
+
+// Change configuration entry for actual extension
+function addConfigChangeSql ($oldColumnName, $newColumnName, $columnSql) {
+       // Add the SQL statement
+       addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_config` CHANGE `' . $oldColumnName . '` `' . $newColumnName . '` ' . $columnSql);
+}
+
 // Enables/disables productive mode for current extension (used only while
 // registration).
 // @TODO This should be rewrittten to allow, more development states, e.g. 'planing','alpha','beta','beta2','stable'