This bug occurs when I try updating Drupal Commons from 7.x-3.1 to 7.x-3.4 following these instructions exactly https://docs.acquia.com/commons/upgrade

After running update.php, I receive the following error :

The following updates returned messages

commons_groups module

Update #3109
Failed: DatabaseSchemaObjectExistsException: Table field_data_field_og_access_default_value already exists. in DatabaseSchema->createTable() (line 657 of /home/_____/dev2/public_html/includes/database/schema.inc).

After I deleted the 'field_data_field_og_access_default_value' table (it was empty) and ran update.php again, I received the same error but this time it referred to 'field_revision_field_og_access_default_value'. I repeated this process with several other tables it complained about until I received the following error :

commons_groups module

Update #3109
Failed: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'affairre_dev2.field_data_field_og_access_default_value' doesn't exist: SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {field_data_field_og_access_default_value} field_data_field_og_access_default_value0 WHERE (field_data_field_og_access_default_value0.deleted = :db_condition_placeholder_0) LIMIT 1 OFFSET 0) subquery; Array ( [:db_condition_placeholder_0] => 0 ) in field_sql_storage_field_storage_query() (line 585 of /home/_____/dev2/public_html/modules/field/modules/field_sql_storage/field_sql_storage.module).

A bit of a catch-22 yeah? The group content access control seems to still be working fine on my site but I am now unable to create new groups or revert the commons groups feature back to default. I will try reverting back to older versions of commons groups while I wait for replies to this issue but I'm not so sure that will work out very nicely.

This is the error that shows up in watchdog when I try to create a group

EntityMetadataWrapperException: Unknown data property field_og_subscribe_settings. in EntityStructureWrapper->getPropertyInfo() (line 339 of /home/affairre/dev2/public_html/profiles/commons/modules/contrib/entity/includes/entity.wrapper.inc).

Comments

Anonymous’s picture

Issue summary: View changes
Anonymous’s picture

I found a solution to my problem.

Before running update.php for the first time, drop field_data_field_og_access_default_value and field_revision_field_og_access_default_value
. Then run update.php, you will get an error similar to the first on in my original post but it will be complaining about field_data_field_og_subscribe_settings. Now drop field_data_field_og_subscribe_settings and field_revision_field_og_subscribe_settings, and run update.php again. The update should happen normally after that.

Anonymous’s picture

Assigned: Unassigned »
Status: Active » Closed (fixed)
tanius’s picture

In addition to #2: If for some reason you cannot find the field_data_field_og_subscribe_settings in your Group content type, alternatively you can remove it on database level like this (at your own risk, since post-removal code will not execute):

ALTER TABLE field_data_field_og_subscribe_settings RENAME orig_field_data_field_og_subscribe_settings;
ALTER TABLE field_revision_field_og_subscribe_settings RENAME orig_field_revision_field_og_subscribe_settings;

When something goes wrong, you have a backup and can still rename the tables back to their original value. It worked for me though.

Also note that, as usual, you can use drush updatedb; drush cc all as an alternative to running update.php.

tanius’s picture

Just tested the solution from #2 with using just drush commands like this, and it worked:

drush sql-query "ALTER TABLE field_data_field_og_access_default_value RENAME orig_field_data_field_og_access_default_value"
drush sql-query "ALTER TABLE field_revision_field_og_access_default_value RENAME orig_field_revision_field_og_access_default_value"
drush updatedb; drush cc all
drush sql-query "ALTER TABLE field_data_field_og_subscribe_settings RENAME orig_field_data_field_og_subscribe_settings"
drush sql-query "ALTER TABLE field_revision_field_og_subscribe_settings RENAME orig_field_revision_field_og_subscribe_settings"
drush updatedb; drush cc all

And one more step just for me, because this was the task blocked by the issue that was now solved above:

drush features-revert -y commons_groups