I would like to safely clean duplicate field revision data. This field_revision_(field_name) data not associated with nodes, but the relation entities.

I'm using the relation module. I'm bumping up against the problem outlined here: https://www.drupal.org/node/1530164

I have a lot of relations on my site linking different entities. My field_revision_endpoints table is growing quite large. The issue mentions as a work around, he uses a sql script to clear out the old revisions. I did some googling on info for deleting revisions, but I'll I have come up with is results relating to deleting node revisions.

Is it safe to simply delete rows out of field_revision_endpoints?

  • How about using Field SQL norevisions? – pierostz Jan 2 '17 at 16:45
  • @pierostz: this looks promising, thanks! I'll give it a try and let you know if it works out for my situation. Maybe you could post it as an answer? – Pete Jan 3 '17 at 17:02
  • I am using it myself for the same reasons. Didn't have a problem until now. – pierostz Jan 3 '17 at 17:04
  • You are using it specifically to reduce the size of field_revision_endpoint? What problem have you run into? – Pete Jan 3 '17 at 17:07
  • Other revision tables growing big and shared hosting – pierostz Jan 3 '17 at 17:09

The answer is no. I eventually had to circle back to this question and come up with a solution myself. The relation_revision table contains the relation + revision ids that match up to the field_revision_endpoints rows. Simply deleting rows from relation_revision would orphan the revision field data in field_revision_endpoint.

After poking around the relations issue queue, I found this patch which adds support for the Entity API's revision deletion mechanism.

Instead of patching the relations module, I used hook_entity_info_alter to register my own 'revision deletion callback' on the relation entity, which I based on the above patch and node_revision_delete(). I can now use the Entity API's entity_revision_delete() to cleanly remove the excess revisions in batches.

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.