diff --git a/field_collection.install b/field_collection.install index c668b12..56fc449 100644 --- a/field_collection.install +++ b/field_collection.install @@ -110,7 +110,9 @@ function field_collection_update_7001() { // Set default to 0 temporarily. 'initial' => 0, ); - db_add_field('field_collection_item', 'revision_id', $revision_id_spec); + if (!db_field_exists('field_collection_item', 'revision_id')) { + db_add_field('field_collection_item', 'revision_id', $revision_id_spec); + } // Initialize the revision_id to be the same as the item_id. db_update('field_collection_item') @@ -124,7 +126,9 @@ function field_collection_update_7001() { 'not null' => TRUE, 'default' => 0, ); - db_add_field('field_collection_item', 'archived', $archived_spec); + if (!db_field_exists('field_collection_item', 'archived')) { + db_add_field('field_collection_item', 'archived', $archived_spec); + } // Create the new table. It is important to explicitly define the schema here // rather than use the hook_schema definition: http://drupal.org/node/150220. @@ -153,7 +157,9 @@ function field_collection_update_7001() { ), ), ); - db_create_table('field_collection_item_revision', $schema['field_collection_item_revision']); + if (!db_table_exists('field_collection_item_revision')) { + db_create_table('field_collection_item_revision', $schema['field_collection_item_revision']); + } // Fill the new table with the correct data. $items = db_select('field_collection_item', 'fci') @@ -180,7 +186,9 @@ function field_collection_update_7001() { // Add a revision_id column. $revision_id_spec['description'] = 'The field collection item revision id.'; - db_add_field($table, $revision_id_column, $revision_id_spec); + if (!db_field_exists($table, $revision_id_column)) { + db_add_field($table, $revision_id_column, $revision_id_spec); + } // Initialize the revision_id to be the same as the item_id. db_update($table)