1

Due to an error during migration, some of the content has been left hanging without a content type and did not port over correctly.

What is the best way to delete these around 1000 records? Unfortunately they do not share any particular characteristics to be able to search them from the frontend easily.

1 Answer 1

3

Due to an error during migration, some of the content has been left hanging without a content type and did not port over correctly

If you're comfortable writing code you could write an SQL query to look for nodes or entities without a type set -- and output or save their IDs to a list. You may be able to use EntityFieldQuery for this but it may blow up, I'm not sure.

Once you have the IDs of content missing it's type you could try to use Drush Entity on your site to delete the entities. It supports deleting a list of entities by their ID (I assume in the Node table). Below is an excerpt from entity.drush.inc

  $items['entity-delete'] = array(
    'description' => 'Delete entities.',
    'arguments' => array(
      'type' => $type,
      'nids' => $nids,
    ),
    'options' => array(
      'json' => $output_json,
      'bundles' => $bundles,
    ),
    'examples' => array(
      'entity-delete' => '.',
      'entity-delete node 64' => '.',
      'entity-delete node --type=story' => '.',
    ),
    'aliases' => array('ed'),
  );

So you could try to take your IDs and issue the command:

drush entity-delete node -v --nids=<list-of-nids-seperated-with-commas>

If this fails try:

drush entity-delete node --debug --nids=<list-of-nids>

Obviously you could try to do this all by hand with a query, and using node_delete() for instance, but I'm trying to find you a slightly less programming intensive solution.

EDIT

1) ALWAYS BACKUP YOUR WEBSITE FILES + DB FIRST BEFORE ATTEMPTING DISASTER RECOVERY.

2) If the data is somehow improperly save and fragmented across disjointed tables good luck -- I've fixed mess-ups like this but end up scanning tables visually by hand and dropping obsolete fields or field_instances for example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.