A typical error would look like:
Updating to version 1.3.6.1 failed with: CDbCommand failed to execute the SQL statement: SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'must_confirm_delivery'
This happens because you have ran an update previously and it failed for whatever reason, most likely if ran it from the web interface and the database connection timed out.
In order to fix this and continue with the update, we should open the file apps/common/data/update-sql/1.3.6.1.sql
from the server and look for the sql query that shows the ‘must_confirm_delivery’ column, remove the entire sql statement, save the file and try to run the update command once again.
In this example, the sql file looks like:
-- -- Update sql for MailWizz EMA from version 1.3.6.0 to 1.3.6.1 -- -- -- Table delivery_server -- ALTER TABLE `delivery_server` ADD `must_confirm_delivery` ENUM('yes','no') NOT NULL DEFAULT 'no' AFTER `force_reply_to`; -- -- Table campaign_delivery_log -- ALTER TABLE `campaign_delivery_log` ADD `delivery_confirmed` ENUM('yes','no') NOT NULL DEFAULT 'yes' AFTER `email_message_id`; ALTER TABLE `campaign_delivery_log` ADD `server_id` INT(11) NULL DEFAULT NULL AFTER `subscriber_id`; ALTER TABLE `campaign_delivery_log` ADD INDEX `fk_campaign_delivery_log_delivery_server1_idx` (`server_id`); ALTER TABLE `campaign_delivery_log` ADD CONSTRAINT `fk_campaign_delivery_log_delivery_server1` FOREIGN KEY (`server_id`) REFERENCES `delivery_server` (`server_id`) ON DELETE SET NULL ON UPDATE NO ACTION; -- -- Table campaign_delivery_log_archive -- ALTER TABLE `campaign_delivery_log_archive` ADD `delivery_confirmed` ENUM('yes','no') NOT NULL DEFAULT 'yes' AFTER `email_message_id`; ALTER TABLE `campaign_delivery_log_archive` ADD `server_id` INT(11) NULL DEFAULT NULL AFTER `subscriber_id`; ALTER TABLE `campaign_delivery_log_archive` ADD INDEX `fk_campaign_delivery_log_archive_delivery_server1_idx` (`server_id`); ALTER TABLE `campaign_delivery_log_archive` ADD CONSTRAINT `fk_campaign_delivery_log_archive_delivery_server1` FOREIGN KEY (`server_id`) REFERENCES `delivery_server` (`server_id`) ON DELETE SET NULL ON UPDATE NO ACTION;
So we look for the sql statment that contains the `must_confirm_delivery` wording and we remove it, so now the update file will look like:
-- -- Update sql for MailWizz EMA from version 1.3.6.0 to 1.3.6.1 -- -- -- Table campaign_delivery_log -- ALTER TABLE `campaign_delivery_log` ADD `delivery_confirmed` ENUM('yes','no') NOT NULL DEFAULT 'yes' AFTER `email_message_id`; ALTER TABLE `campaign_delivery_log` ADD `server_id` INT(11) NULL DEFAULT NULL AFTER `subscriber_id`; ALTER TABLE `campaign_delivery_log` ADD INDEX `fk_campaign_delivery_log_delivery_server1_idx` (`server_id`); ALTER TABLE `campaign_delivery_log` ADD CONSTRAINT `fk_campaign_delivery_log_delivery_server1` FOREIGN KEY (`server_id`) REFERENCES `delivery_server` (`server_id`) ON DELETE SET NULL ON UPDATE NO ACTION; -- -- Table campaign_delivery_log_archive -- ALTER TABLE `campaign_delivery_log_archive` ADD `delivery_confirmed` ENUM('yes','no') NOT NULL DEFAULT 'yes' AFTER `email_message_id`; ALTER TABLE `campaign_delivery_log_archive` ADD `server_id` INT(11) NULL DEFAULT NULL AFTER `subscriber_id`; ALTER TABLE `campaign_delivery_log_archive` ADD INDEX `fk_campaign_delivery_log_archive_delivery_server1_idx` (`server_id`); ALTER TABLE `campaign_delivery_log_archive` ADD CONSTRAINT `fk_campaign_delivery_log_archive_delivery_server1` FOREIGN KEY (`server_id`) REFERENCES `delivery_server` (`server_id`) ON DELETE SET NULL ON UPDATE NO ACTION;
We save the file and run the update command once again.
We follow all the above steps each time the application complaints about a column already existing in the database.
Once it stops complaining, the update process will continue and finish without errors.
Comments
0 comments
Article is closed for comments.