You are here

function _crm_core_contact_check_uuid in CRM Core 7

Helper to check uuid fields existence.

2 calls to _crm_core_contact_check_uuid()
crm_core_contact_update_7005 in modules/crm_core_contact/crm_core_contact.install
UUID integration.
crm_core_contact_uuid_sync in modules/crm_core_contact/crm_core_contact.module
Implements hook_uuid_sync().

File

modules/crm_core_contact/crm_core_contact.module, line 1776
Provides default CRM Core Contact entities and the ability to create more.

Code

function _crm_core_contact_check_uuid() {
  $schema_changed = FALSE;
  module_load_include('install', 'uuid', 'uuid');
  $field = uuid_schema_field_definition();
  if (!db_field_exists('crm_core_contact', 'uuid')) {
    db_add_field('crm_core_contact', 'uuid', $field);
    db_add_index('crm_core_contact', 'uuid', array(
      'uuid',
    ));
    $schema_changed = TRUE;
  }
  if (!db_field_exists('crm_core_contact_revision', 'vuuid')) {
    db_add_field('crm_core_contact_revision', 'vuuid', $field);
    db_add_index('crm_core_contact_revision', 'vuuid', array(
      'vuuid',
    ));
    $schema_changed = TRUE;
  }
  if ($schema_changed) {
    drupal_get_schema(NULL, TRUE);
  }
}