Changing the config of our default menu results in a SQL error and the menu config not being stored.

We currently use the other Megamenu module and have a large site with an extensive ribbon menu. It turns out that the field menu_config in tb_megamenus table defaults to 'Text' which is not big enough to store our menu config.

Changing it to 'Longtext' resolves this.

Comments

aubjr_drupal’s picture

Title: Menu Config not being saved. » block_config and menu_config DB column sizes too small
Version: 7.x-1.0-beta5 » 7.x-1.x-dev
Priority: Normal » Critical
StatusFileSize
new1.34 KB

This is a real issue that our organization has run into with multiple sites; The DB column sizes are too small. Taken from MySQL documentation:

TEXT | 65,535 (216−1) bytes = 64 KiB
MEDIUMTEXT | 16,777,215 (224−1) bytes = 16 MiB
LONGTEXT | 4,294,967,295 (232−1) bytes = 4 GiB

64K isn't enough for large menus. We didn't go as far as a "longtext" - just "mediumtext".

Patch attached, made against the latest dev version.

Note: Since there are no indices/keys affected with this change, I used a simpler db_query() instead of the more formal Database API's db_change_field().

aubjr_drupal’s picture

Status: Active » Needs review
Issue tags: +database schema
aubjr_drupal’s picture

I got the Database API entry incorrect in tb_megamenu.install - Fixed in this comment's patch.

andrewozone’s picture

Issue tags: +GovCon2020
quondam’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #3 applies cleanly to 7.73. Including testing & validation process below to reproduce this issue in case the patch needs to be re-rolled and reviewed again at a later date.

Install and enable the Devel and Devel Generate modules, then use the Generate menus link to add a large number of links to the main menu (say, 500+). Once that finishes, edit the config for the main-menu TB Megamenu, changing a few options like style and animation, then save. An Ajax status message will appear, erroneously claiming the changes were saved - however viewing the logs will reveal the SQL error referenced above in the original description, and on a page reload the previous values/default config will still display. After applying the patch, clearing cache and then re-saving the config changes no SQL error is found in the logs; reloading the admin page reveals that the config changes were captured and the form is pre-populated with those values.

knaffles’s picture

  • 7e08220 committed on 7.x-1.x
    Issue #2490224 by aubjr_drupal, quondam: block_config and menu_config DB...
knaffles’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.