3.68 install with existing schemas ***Fails***

6 posts by 2 authors in: Forums > CMS Builder
Last Post: April 29, 2024   (RSS)

By kitsguru - April 28, 2024

I have tracked the problem down. I started with a clean install of CMSB 3.68, no problems creating a new database.

Copied schemas from a current project that uses CMSB 3.68 into the clean install. I could not enter the Database editor - error Field "num" does not exist.

Removed all add schemas and moved them in one at a time until I hit the error. Turns out the menugroup type is the cause.

Old Format

<?php /* This is a PHP data file */ if (empty($LOADSTRUCT)) { die("This is not a program file."); }
return array (
  '_description' => '',
  '_detailPage' => '',
  '_disableAdd' => '0',
  '_disableErase' => '0',
  '_disableEraseFromModify' => '0',
  '_disableModify' => '0',
  '_disablePreview' => '0',
  '_disableView' => '0',
  '_filenameFields' => '',
  '_hideRecordsFromDisabledAccounts' => '0',
  '_indent' => '0',
  '_listPage' => '',
  '_maxRecords' => '',
  '_maxRecordsPerUser' => '',
  '_perPageDefault' => '25',
  '_previewPage' => '',
  '_primaryKey' => 'num',
  '_requiredPlugins' => '',
  '_tableName' => 'blog_module',
  'listPageFields' => NULL,
  'listPageOrder' => '',
  'listPageSearchFields' => '',
  'menuHidden' => false,
  'menuName' => 'Blog  Module',
  'menuOrder' => '0000000007',
  'menuType' => 'menugroup',
);

New Format

<?php /* This is a PHP data file */ if (empty($LOADSTRUCT)) { die("This is not a program file."); }
return array (
  '_detailPage' => '',
  '_filenameFields' => '',
  '_indent' => '0',
  '_primaryKey' => 'num',
  '_tableName' => 'testing_menugroup',
  'menuName' => 'testing',
  'menuOrder' => 1714325050,
  'menuType' => 'menugroup',
);

The solution was to delete all the MenuGroup tables in the database editor and then recreate them to get the new format.

Jeff Shields

By kitsguru - April 28, 2024 - edited: April 28, 2024

Reports builder, Newsletter Builder 3 and Simple Forum on activate caused Database Editor to throw same error

Field 'num' not found in schema
/Volumes/J/@projects/yaaws5/html/www/cmsb/lib/Fields/Factory.php on line 32
https://yaaws5.yaa.test/cmsb/admin.php?menu=database
Jeff Shields

3.68 install with existing schemas ***BUG***

By kitsguru - April 28, 2024 - edited: April 28, 2024

When I copied all the files to the production server, the installation failed. 

I was able to compete the install on the server by removing all menugroups I had created.YEAH

I then created a new menu group for my blog module on my development machine and copied it to the server.

I added a print_r($schema) just before the exception in the Factory.

When I went to access cmsb I got the error

Array ( [_detailPage] => [_filenameFields] => [_indent] => 0 [_primaryKey] => num [_tableName] => blog_module_menugroup [menuName] => Blog Module [menuOrder] => 0000000007 [menuType] => menugroup ) 

Error: Field 'num' not found in schema

There is no number field in the schema, but it is a database. Here is the create statement generated by the Developer Console

CREATE TABLE `cmsb_blog_module_menugroup` (
  `num` int(10) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`num`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC

This is the INI file, and no num field is defined.

<?php /* This is a PHP data file */ if (empty($LOADSTRUCT)) { die("This is not a program file."); }
return array (
  '_detailPage' => '',
  '_filenameFields' => '',
  '_indent' => '0',
  '_primaryKey' => 'num',
  '_tableName' => 'blog_module_menugroup',
  'menuName' => 'Blog Module',
  'menuOrder' => '0000000007',
  'menuType' => 'menugroup',
);
Jeff Shields

By kitsguru - April 29, 2024

FINAL FIX:

In the "/cmsb/data/schemaPresets/customMenuGroup.ini.php" I added this to the end of the array

  'num' => array(
    'order' => 1,
    'type' => 'none',
    'label' => 'Record Number',
    'isSystemField' => '1',
  ),
Jeff Shields

By Dave - April 29, 2024

Hi Jeff, 

Thanks so much for reporting this and tracking it down!  We'll have a fix out for this in the next release shortly.

Dave Edis - Senior Developer
interactivetools.com