I would like to know if this behaviour is by default when uninstalling OG, or that it is caused by another module?

When I uninstall OG, the entityreference fields that had OG behaviour assigned, are automatically deleted.

This is not desirable since I installed OG on an existing site with hundreds of entities actively using that entityreference field. I enabled OG behaviour on that field after installation of OG, and now after the uninstall of OG these fields are deleted, no trace left.

Comments

Yuri created an issue. See original summary.

Yuri’s picture

Issue summary: View changes
Xilis’s picture

Taken from og_uninstall():

  // Delete OG-core fields.
  $og_fields = array(
    'group_group',
    'og_description',
    'og_membership_request',
  );

  foreach (field_info_instances() as $bundles) {
    foreach ($bundles as $instances) {
      foreach ($instances as $instance) {
        if (in_array($instance['field_name'], $og_fields)) {
          field_delete_instance($instance);
        }
        else {
          $field = field_info_field($instance['field_name']);
          if ($field['type'] == 'entityreference' && ($field['settings']['handler'] == 'og' || strpos($field['settings']['handler'], 'og_') === 0)) {
            // Last instance will take care also of deleting the field itself.
            field_delete_instance($instance);
          }
        }
      }
    }
  }

So yes, og fields ('group_group', 'og_description', 'og_membership_request') and entityreference fields where og is the handler get deleted.

Xilis’s picture

Status: Active » Closed (works as designed)