function field_collection_update_7003 in Field collection 7
Update field_collection_field_schema columns for all tables.
File
- ./
field_collection.install, line 247 - Install, update and uninstall functions for the field_collection module.
Code
function field_collection_update_7003() {
// Revision_id column.
$revision_id_spec = array(
'type' => 'int',
'not null' => FALSE,
'description' => 'The field collection item revision id.',
'initial' => 0,
);
// Update the field_collection_field_schema columns for all tables,
// in case the buggy beta5 version of field_collection_update_7001()
// completed without complaint.
foreach (field_read_fields(array(
'type' => 'field_collection',
)) as $field_name => $field) {
$table_prefixes = array(
'field_data',
'field_revision',
);
foreach ($table_prefixes as $table_prefix) {
$table = sprintf('%s_%s', $table_prefix, $field_name);
$value_column = sprintf('%s_value', $field_name);
$revision_id_column = sprintf('%s_revision_id', $field_name);
db_change_field($table, $revision_id_column, $revision_id_column, $revision_id_spec);
}
}
// Need to get the system up-to-date so drupal_schema_fields_sql() will work.
$schema = drupal_get_schema('field_collection_item_revision', TRUE);
}