This simple patch tests for the existence of the table before attempting the creation of the table, which avoids the PDO

"DatabaseSchemaObjectExistsException: Table cache_token already exists."

error that causes the entire update hook to fail.

CommentFileSizeAuthor
#1 token_safely_create_table_1464928.patch525 bytesSenpai
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Senpai’s picture

Status: Active » Needs review
FileSize
525 bytes
Dave Reid’s picture

Status: Needs review » Fixed

Thanks. Committed with a minor tweak to http://drupalcode.org/project/token.git/commit/a2d2622

Status: Fixed » Closed (fixed)

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

monti’s picture

Version: 7.x-1.x-dev » 7.x-1.1
Assigned: Senpai » Unassigned

reopen this issue. it is still not fixed at 7.x-1.1.

Dave Reid’s picture

Version: 7.x-1.1 » 7.x-1.x-dev

How is this not fixed? Please try again.

function token_update_7000() {
  if (!db_table_exists('cache_token')) {
    $schema = drupal_get_schema_unprocessed('system', 'cache');
    $schema['description'] = 'Cache table for token information.';
    db_create_table('cache_token', $schema);
  }
}
pmagunia’s picture

Not sure why but I had this problem too in the 1.5 version. I cleared all caches, ran updates, and cron.

I took a look at cache_token and it didn't have any entries so I dropped it.

The install went fine after that.