Skip to content

Instantly share code, notes, and snippets.

@szeidler
Created August 28, 2014 14:17
Show Gist options
  • Save szeidler/8fefd5f505e9c2e07363 to your computer and use it in GitHub Desktop.
Save szeidler/8fefd5f505e9c2e07363 to your computer and use it in GitHub Desktop.
Clean field_collection data, when migrating existing fields
#!/usr/bin/env drush
$result = db_query("SELECT id, data from field_config where type = 'field_collection'");
foreach ($result as $field) {
$data = unserialize($field->data);
$data['indexes'] = array('revision_id' => array('revision_id'));
$data = serialize($data);
db_query("update field_config set data = :data where id = :id", array(':data' => $data, ':id'=> $field->id));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment