I upgraded to 7.50, ran the utf8mb4 convert drush commmand, and enabled utf8mb4 in settings.php. Before running the utf8mb4 convert drush command, I did have to convert several columns manually like this:

ALTER TABLE commerce_order CHANGE order_number order_number VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

I tested my site and as far as I can tell everything is working fine.

However, when I try to enable the update module (which had been uninstalled on the site), I get the following error:

cpu:update pk$ drush @mysite en update
PTY allocation request failed on channel 0
The following extensions will be enabled: update
Do you really want to continue? (y/n): y
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1071    [error]
Specified key was too long; max key length is 767 bytes in
Stack trace:
DatabaseStatementBase->execute(Array, Array)
DatabaseConnection->query('CREATE TABLE {c...')
DatabaseSchema->createTable('cache_update', Array)
db_create_table('cache_update', Array)
#6 /opt/pantheon/drush-8/commands/core/drupal/environment_7.inc(143):
#7 /opt/pantheon/drush-8/commands/pm/pm.drush.inc(1167):
#8 /opt/pantheon/drush-8/includes/command.inc(366):
#9 /opt/pantheon/drush-8/includes/command.inc(217):
_drush_invoke_hooks(Array, Array)
#10 /opt/pantheon/drush-8/includes/command.inc(185):
#11 /opt/pantheon/drush-8/lib/Drush/Boot/BaseBoot.php(67):
#12 /opt/pantheon/drush-8/includes/preflight.inc(66):
#13 /opt/pantheon/drush-8/drush.php(12): drush_main()
#14 {main}

When I enable the update module, it isn't able to create the update or cache_update tables. How can I fix this?


Hacking core, not a great answer. This is just the best I have found so far.

In modules/update/update.install:

 * Implements hook_schema().
function update_schema() {
  $schema['cache_update'] = drupal_get_schema_unprocessed('system', 'cache');
  $schema['cache_update']['description'] = 'Cache table for the Update module to store information about available releases, fetched from central server.';
  return $schema;

So I went to modules/system/system.install:

  $schema['cache'] = array(
    'description' => 'Generic cache table for caching things not separated out into their own tables. Contributed modules may also use this to store cached items.',
    'fields' => array(
      'cid' => array(
        'description' => 'Primary Key: Unique cache ID.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      'data' => array(
        'description' => 'A collection of data to cache.',
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
      'expire' => array(
        'description' => 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      'created' => array(
        'description' => 'A Unix timestamp indicating when the cache entry was created.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      'serialized' => array(
        'description' => 'A flag to indicate whether content is serialized (1) or not (0).',
        'type' => 'int',
        'size' => 'small',
        'not null' => TRUE,
        'default' => 0,
    'indexes' => array(
      'expire' => array('expire'),
    'primary key' => array('cid'),

And I changed the length of the varchar for the primary key from 255 to 191. Now I can enable and disable the update module properly.

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.