As a prelude to try and automate the process of creating Drupal dumps for upgrade testing, this is a followup issue for #1182296: Add tests for 7.0->7.x upgrade path (random test failures). There was actually an error in the generate-d7-content.sh script that causes a PDOException. We removed a line $node_type = 'broken'; from the patch since it didn't seem to be getting used anywhere else. However, the db_update lines that come after are changing the content type into a 'broken' content type (so it start off as an article, gets the fields saved to the corresponding tables, then changes to broken; this would not otherwise happen correctly on a content type that does not initially exist) to make sure the upgrade works on a bundle whose parent is disabled.

Attaching patch in upcoming comment.

CommentFileSizeAuthor
#4 1356358.patch731 bytesbtmash
#3 1356358.patch588 bytesbtmash
#1 1356358.patch400 bytesbtmash

Comments

btmash’s picture

StatusFileSize
new400 bytes

Attaching patch which should fix this. As a note, this issue does not exist for D8 since it was correctly written to begin with :)

As a note...dumps will need to be created...again. *sigh*

btmash’s picture

Status: Active » Needs review

Ack...needs review for this atleast.

btmash’s picture

StatusFileSize
new588 bytes

Argh...changing patch again.

btmash’s picture

StatusFileSize
new731 bytes

Ok, added a few more comments explaining the reason for why we create a variable for the node type.

xjm’s picture

Status: Needs review » Reviewed & tested by the community

Ah! Now I understand why this was the way it was before we changed it. For reference, here is how $node and $node_type are used later on in the script:


node_save($node);
db_update('node')
  ->fields(array(
    'type' => $node_type,
  ))
  ->condition('nid', $node->nid)
  ->execute();
if (db_table_exists('field_data_body')) {
  db_update('field_data_body')
    ->fields(array(
      'bundle' => $node_type,
    ))
    ->condition('entity_id', $node->nid)
    ->condition('entity_type', 'node')
    ->execute();
  db_update('field_revision_body')
    ->fields(array(
      'bundle' => $node_type,
    ))
    ->condition('entity_id', $node->nid)
    ->condition('entity_type', 'node')
    ->execute();
}
db_update('field_config_instance')
  ->fields(array(
    'bundle' => $node_type,
  ))
  ->condition('bundle', 'article')
  ->execute();

The added comment makes this a lot more clear.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Huh. Oooookaayyyy. :)

Committed and pushed to 7.x. Thanks!

Status: Fixed » Closed (fixed)

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