I am doing a migration from D7 to D8. Due to various issues in the initial site, I am doing content migration through CSV import rather than the direct drupal to drupal migration that's built in.

My content type has a Video Embed Field in it, which was throwing errors on migration unless it was filled. As such, I had to throw in a placeholder video URL for all nodes that didn't have the node filled.

Is there a way to (within drupal, or via a SQL query) programatically remove the field content from all nodes where the url is "youtube.com/myPlaceholderVideo"? All the content is in, but now I'm stuck with ~450 nodes with this placeholder URL.

1 Answer 1


The video_embed_field module adds a simple field based on whatever you named it. So if your field is named "field_youtube_embed_test", you'd get a field on your content type that is a standard drupal field, with a table "node__field_youtube_embed_test" and a revision table "node_revision__field_youtube_embed_test". You can run a query to delete all entries based on bundle as that is one of the columns on both tables. So you can run a query for each.

DELETE from node__field_youtube_embed_test where field_youtube_embed_test_value = 'youtube.com/myPlaceholderVideo' and bundle = 'article';

DELETE from node_revision__field_video_embed where field_youtube_embed_test_value = 'youtube.com/myPlaceholderVideo' and bundle = 'article';

Or if you want to delete everything from those tables, you just use the truncate command:

TRUNCATE node__field_youtube_embed_test;

TRUNCATE node_revision__field_video_embed;

Using a query works for simple fields such as textfields, booleans, etc, but it doesn't work for more complex structures such as field collections or paragraphs. For those, you would probably want to iterate through them programmatically and unset the value and then save the node.

  • 1
    Thanks for the suggestion. Are those the only places with any reference to the field value? Because I tried deleting a single line from each of those tables yesterday, but the value still seemed to be showing up when I went to edit the node.
    – Mrweiner
    Nov 17, 2016 at 20:45
  • 1
    Nodes are cached, so you'll need to clear the cache or turn off caching.
    – oknate
    Nov 17, 2016 at 20:56
  • Well it worked this time, so there must have been something else going on yesterday. Thanks!
    – Mrweiner
    Nov 18, 2016 at 3:40

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.