You are here

function salesforce_api_schema in Salesforce Suite 7

Same name and namespace in other branches
  1. 6.2 salesforce_api/salesforce_api.install \salesforce_api_schema()
  2. 7.2 salesforce_api/salesforce_api.install \salesforce_api_schema()

Implements hook_schema().

File

salesforce_api/salesforce_api.install, line 36
Installs any global tables needed for Salesforce integration.

Code

function salesforce_api_schema() {
  $schema['salesforce_object_map'] = array(
    'description' => 'Drupal to Salesforce object mapping table',
    'fields' => array(
      'fieldmap' => array(
        'description' => 'Fieldmap id',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'oid' => array(
        'description' => 'Specific Drupal object identifier (e.g. node id or comment id)',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'sfid' => array(
        'description' => 'Salesforce object identifier (e.g. "node", "comment")',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'drupal_entity' => array(
        'description' => 'Drupal entity (e.g. "node", "user")',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'drupal_bundle' => array(
        'description' => 'Drupal bundle (e.g. "page", or vocabulary name)',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'indexes' => array(
      'sfid' => array(
        'sfid',
      ),
    ),
    'primary key' => array(
      'drupal_entity',
      'drupal_bundle',
      'oid',
    ),
  );
  $schema['salesforce_field_map'] = array(
    'description' => 'Drupal to Salesforce field mappings',
    'fields' => array(
      'fieldmap' => array(
        'description' => 'The primary identifier for a fieldmap.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'automatic' => array(
        'description' => 'Boolean indicating whether this action/map is automatic or triggered.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
      ),
      'salesforce' => array(
        'description' => 'The kind of Salesforce object this map is for.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'drupal_entity' => array(
        'description' => 'The Drupal entity for this object map (e.g. "node", "user").',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'drupal_bundle' => array(
        'description' => 'The Drupal bundle for this object map (e.g. "page" or vocabulary name)',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'description' => array(
        'description' => 'Name or brief description of this fieldmap',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
        'default' => '',
      ),
      'fields' => array(
        'description' => 'Serialized fieldmap',
        'type' => 'text',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'fieldmap',
    ),
  );
  return $schema;
}