Skip to content

Instantly share code, notes, and snippets.

@thelebster
Forked from szeidler/fix-fields.drush
Created October 22, 2016 05:49
Show Gist options
  • Select an option

  • Save thelebster/d74cfb4efe7c27143d18f923233776b8 to your computer and use it in GitHub Desktop.

Select an option

Save thelebster/d74cfb4efe7c27143d18f923233776b8 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