Error: Data isn't compatible with new type

2 posts by 2 authors in: Forums > CMS Builder
Last Post: 2 hours ago   (RSS)

Hit this on the latest version. Created a field as a Text Box by mistake, then went to switch its type to Checkbox in the field editor. The save fails with a MySQL type-compatibility error.

Steps to reproduce

  1. In a section editor, add a new field and set the type to Text Box.
  2. Save. (The column gets created across every existing record in the table.)
  3. Edit that same field and change the type to Checkbox.
  4. Save → error.

Error returned

Error: Data in `my_field` isn't compatible with new type:
tinyint unsigned NOT NULL DEFAULT 0

Please modify your data or column type and try again.

Query: ALTER TABLE `cms_example` CHANGE COLUMN `my_field` `my_field`
       tinyint unsigned NOT NULL DEFAULT 0
in [path]/cmsb/lib/Fields/BaseField.php:510  [Admin View]

Backtrace (CMS paths only)

#0 Script started        cmsb/admin.php:0
#1 require()             cmsb/admin.php:82
#2 include()             cmsb/lib/menus/default/actionHandler.php:65
#3 require()             cmsb/lib/menus/database/actionHandler.php:72
#4 require()             cmsb/lib/menus/database/editField.php:8
#5 submitFormViaAjax()   cmsb/lib/menus/database/editField_functions.php:179
...
Thanks,

Kenny H