0

I want to remove all the relations (created with the Relation module) on my site because I have replaced them with an entityreference field.

At /admin/structure/relation, I can delete the Relation Types, but this does not delete the relations belonging to each type.

At /admin/content/relation, I can delete the relations individually, but there are 100K relations on this site.

At /admin/structure/views/view/relations/edit/page, with the Views Bulk Operations module enabled, I can change the contextual filter Relation: relation type to "Display all results for the specified field" for When the filter value is NOT in the URL and then add a bulk operation to delete item under Fields. This allows me to go to /relations and trigger a bulk operation to delete all the relations.

Is there a faster way that doesn't involve customizing views?

  • Do you actually need the module still? Are there any other Relations, or is this truly all of them? – mpdonadio Apr 5 '16 at 19:40
  • @MPD I'm nearly 100% sure that I have converted all of them to entityreferences, and I'm running this on a dev server first to make sure. – Patrick Kenny Apr 5 '16 at 19:41
1

There are many ways to delete relations on a site. Relations are Entities in Drupal.

  1. The Delete All module can help with this process.
  2. The Drush Entity command set has a delete function which takes a content type I believe.
  3. With care you could by hand TRUNCATE the relation table, and destroy and drupal Fields that use relations. (I've done this on a few sites).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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