Bug #22872 Bug Fixed

Changing from Date field to a different compatible field triggers error and data loss

Version: 3.4.7 Reporter: Derek Hogue

This is an archived bug report. If you are experiencing a similar issue, upgrade to the latest release and if that does not solve the problem, submit a new bug report

I have an add-on (Event Helper) which is declared compatible with Date fields in the add-on setup file. I was just alerted via a support request that when changing an existing Date field to an Event Helper field, it triggers an error. I just confirmed locally.

Unknown column 'field_id_10' in 'exp_channel_data':
ALTER TABLE `exp_channel_data` CHANGE `field_id_10` `field_id_10` INT(10)

It appears that rather than the diff method running to properly drop only what’s needed and change existing cols, th field is being dropped entriely, and thus can’t be updated.

If I first create and Event Helper field, then convert it to a Date field, it converts properly.

I do have a settings_modify_column method:

function settings_modify_column($data)
{
    $fields['field_id_'.$data['field_id']] = array(
     'type' => 'INT',
     'constraint' => 10
    );
    return $fields;
}

But even if I remove that method, the same error is triggered (the error indicates that EE is trying to change the field to ‘text’ in that case).

I can send a copy of the add-on if you like.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases