When updating code from beta4 to beta5, update 7007 gave this error message in drush.

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal7_ataglanc.atag_taxonomy_term_data' doesn't exist
Performed update: metatag_update_7007

The taxonomy module is not compulsory but there is no guard on an attempt to join its table in metatag_update_7007().

<?php
  $result = db_query("DELETE m
    FROM {metatag} m
    LEFT OUTER JOIN {taxonomy_term_data} t
        ON m.entity_id=t.tid
    WHERE m.entity_type='taxonomy_term'
        AND t.tid IS NULL");
  if ($result->rowCount() > 0) {
    drupal_set_message(t('Removed @count meta tag record(s) for taxonomy terms that had been purged.', array('@count' => $result->rowCount())));
  }
?>

The update proceeds even with this error as the update does not return a status array.

CommentFileSizeAuthor
#2 metatag-n1952190-2.patch1.58 KBdamienmckenna

Comments

artis’s picture

I also ran into this issue on one of my sites. The workaround until this can get fixed is to turn on Taxonomy module, perform db updates, then turn off Taxonomy mondule.

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new1.58 KB

Sorry about that everyone :(

damienmckenna’s picture

Status: Needs review » Fixed

Committed.

traveller’s picture

The patch in #2 didn't help with upgrading the module on a Postgresql database. I'll get:

PDOException: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "m" LINE 1: DELETE m ^: DELETE m FROM {metatag} m LEFT OUTER JOIN {node} n ON m.entity_id=n.nid WHERE m.entity_type='node' AND n.nid IS NULL; Array ( ) in metatag_update_7007() (line 325 of /var/www/drupal/sites/all/modules/metatag/metatag.install).

Not quite sure, if I'm doing something wrong, or is it a PSQL issue.

damienmckenna’s picture

@traveller: Please open a new issue for this.

damienmckenna’s picture

Marked #1961066: DB Update as a duplicate.

damienmckenna’s picture

Status: Fixed » Closed (fixed)

1.0-beta6 is out, so I'm closing this issue in the interest of keeping the issue queue clean.