When updating from version 7.x-1.1 to 7.x-1.3, I get the following error when running update.php:
Update #7001
Failed: PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'ipaddr' at row 1: ALTER TABLE {mail_logger} CHANGE `ipaddr` `ipaddr` VARCHAR(45) NOT NULL COMMENT 'IP Address of User'; Array ( ) in db_add_field() (line 2844 of /srv/bindings/de71ccf0a5794ba09f78a2e9b8ee1639/code/includes/database/database.inc).
It appears that this does NOT prevent the mail logger from either working or displaying the outgoing mail log, but I will not be pushing this update live without knowing whether or not this could cause any other problems my testing might not have turned up.
If there is any other information needed to debug this, let me know and I'll do my best to get it for you.
Dan
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | mail_logger-ipaddr_update_hook_corrupt-2668458-3.patch | 1.62 KB | rjacobs |
Comments
Comment #2
rjacobs commentedI noticed this warning as well. It appears to be specific to changes introduced in 7.x-1.3 and related to the creation of a new "ipaddr" column in the mail_logger DB table (via
mail_logger_update_7001()). The column does appear to be created despite the warning, which likely explains why things continue to function.The new column spec sets "not null" but does not provide a default. I think this is fine for new installations, but for sites being updated, with existing rows in the mail_logger table, I think this may cause some issues. Though the column will get created it's initial value for existing rows will be NULL, which is probably not so good for a NOT NULL column definition. I'm not sure how this would lead specifically to a "data truncated" warning, but it still seems like defining a default value would solve things. Maybe someone with more intimate knowledge of D7 schema definitions would be able to confirm this?
Comment #3
rjacobs commentedIt looks like the schema does not need an official default value on the ipaddr column so long as the update specifies an initial value. My assumption is that an empty string would be an appropriate initial value for this case, so the fix here is really just a one liner in
mail_logger_update_7001()such that'initial' => ''is added to the field spec.However, we still have a significant problem for any users who have already tried to update to 7.x-1.3. These users' failed attempt at the initial update may have left them with potentially corrupt data and schema info. Even if they use a patched version (with the fix described above) they will still potentially have NULL values in their ipaddr column and incorrect null/default settings on their DB server. This probably means:
The attached patch takes a stab at this.
Comment #4
rjacobs commentedComment #5
nancydruThanks for the patch. I had found that simply rerunning update.php seemed to "fix" it, but this is better.
Comment #6
nancydruComment #9
rjacobs commentedI just wanted to see if the maintainers are close to tagging a 1.4 release. This issue may be forcing some people to stay at 1.2 (as in our case), or if they did already move to 1.3 they may have some bad data in their DB.
Comment #10
nancydrudone
Comment #11
rjacobs commentedGreat, thanks!