2

I've just changed a rich text field to a number field and am now unable to bring up either the front-end or the dashboard because of multiple CDbException errors. When trying to access /admin, here's the first line of the error message:

CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'content.field_sqFt' in 'field list'

I changed a rich text field named projectDescription to a number field named sqFt. I understand that the new column can't be found.

When updating a field type, I know that there's a chance for data loss. Data loss would be ok for the entries that this change would affect. But I've made other changes since my last backup that I'd like to retain if possible.

I'm running the latest Craft Pro.

  • I tried replicating this locally (changing the field type as well as the field handle) and am not able to. Did you make any other changes? – Brad Bell Oct 21 '15 at 18:25
  • I renamed some field groups just prior to this change. But that seemed to work without problems and I don't think that field group names would be related to this. – plaintxt Oct 21 '15 at 19:24
  • If you want, you can send a database backup to support@buildwithcraft.com and we can look into it from our end. – Brad Bell Oct 21 '15 at 19:37
  • Great thanks. I'll include a current db and the one just before that. – plaintxt Oct 21 '15 at 19:40
  • I've just imported my most recent backup and have changed the field type again. Here's the resulting CDbException, received directly after submitting the change (no refresh etc): CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '<p>A three-story office building, 123 East Pine Street boasts move-in-ready, furnished executive suites on the first floor a' for column 'field_sqFt' at row 160. The SQL statement executed was: ALTER TABLE craft_content` CHANGE field_projectDescription field_sqFt INT(10) UNSIGNED NULL DEFAULT 0` – plaintxt Oct 21 '15 at 19:50
0

Two issues here.

The first error was already a known issue:

General error: 1366 Incorrect integer value

When MySQL's strict mode is enabled, you can get errors like this when swapping an existing field from one type to another where the underlying MySQL datatypes aren't compatible. Swapping from Checkbox to Lightswitch is another time when this could occur.

That one is on our bug tracker, but it's going to be quite an involved fix, so we haven't gotten around to it yet.

The second issue is the one you found. Making the swap from one field type to another and changing the field handle at the same time would not only cause the known error to occur, it would render the rest of the control panel unusable. That bug has been fixed for the next (post 2.4.2700) release.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.