PDOException: SQLSTATE[42S02]: Base table or view not found:

Created on 17 February 2013, almost 12 years ago
Updated 10 November 2024, 24 days ago

Hi. I get this error immediately after installing flags.

πŸ› Bug report
Status

Active

Version

3.9

Component

Flag core

Created by

πŸ‡ΈπŸ‡°Slovakia loparr

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States jenlampton

    The tip from comment #10 worked for me, but after the upgrade (via the Durpal UI) I still get a failure because update 7301 failed at the rename of the flags table, but succeeded with the rename of the `flag_content` table. Since the whole update needs to be repeated, it's now failing at the rename of the `flag_content` table.

    Failed: DatabaseSchemaObjectExistsException: Cannot rename flag_content to flagging: table flagging already exists. in DatabaseSchema_mysql->renameTable() (line 320 of /var/www/html/docroot/includes/database/mysql/schema.inc).
    

    I also made the following changes to `flag_update_7301()`:

    function flag_update_7301() {
      if (db_table_exists('flag_content')) {
        if (!db_table_exists('flagging')) {
          db_rename_table('flag_content', 'flagging');
        }
        else {
          db_drop_table('flag_content');
        }
      }
      if (db_table_exists('flags')) {
        db_rename_table('flags', 'flag');
      }
      // A second cache clear appears to be required here...
      cache_clear_all();
      // ...which in fact isn't enough, as the schema cache appears to need explicit
      // clearing to prevent the next updates failing to get the schema for the new
      // table names.
      drupal_get_schema(NULL, TRUE);
    }
    
Production build 0.71.5 2024