Is it save to run the database update script again after an error?


(farwaykorse) #1

While running the database update I encountered an error.
Running from commandline and with ‘record_statistics = 0’, on a small install. (database size 7.6 Mb).
The update took about a minute and broke with:

[X] Critical Error during the update process:

  • …/piwik/core/Updates/1.6-b1.php:
    Error trying to execute the query ‘ALTER TABLE piwik_log_conversion_item ADD
    idaction_category2 INTEGER(10) UNSIGNED NOT NULL AFTER idaction_category, ADD
    idaction_category3 INTEGER(10) UNSIGNED NOT NULL, ADD idaction_category4
    INTEGER(10) UNSIGNED NOT NULL, ADD idaction_category5 INTEGER(10) UNSIGNED NOT
    NULL’.
    The error was: SQLSTATE[HY000]: General error: 2006 MySQL server has gone
    away

I ran the database-update-script again and now it completed it in a second.
Piwik seems to work correctly now.

My question being:
Is it ok to rerun a update-script like this, or can I expect problems?

edit: From v1.5.1 to v1.6
edit2: better title


(Matthieu Aubry) #2

I recommend you execute again:


ALTER TABLE piwik_log_conversion_item
ADD idaction_category2 INTEGER(10) UNSIGNED NOT NULL AFTER idaction_category,
ADD idaction_category3 INTEGER(10) UNSIGNED NOT NULL,
ADD idaction_category4 INTEGER(10) UNSIGNED NOT NULL,
ADD idaction_category5 INTEGER(10) UNSIGNED NOT NULL

If it triggers an error (field already exists) then it means the update worked the second time.


(farwaykorse) #3

Ok, thanks.
The second time it ran without any problems or warnings.