function salesforce_api_schema in Salesforce Suite 6.2
Same name and namespace in other branches
- 7 salesforce_api/salesforce_api.install \salesforce_api_schema()
- 7.2 salesforce_api/salesforce_api.install \salesforce_api_schema()
Implementation of hook_schema().
File
- salesforce_api/
salesforce_api.install, line 35 - Installs any global tables needed for Salesforce integration.
Code
function salesforce_api_schema() {
require_once drupal_get_path('module', 'salesforce_api') . '/salesforce_api.module';
$schema['salesforce_object_map'] = array(
'description' => t('Drupal to Salesforce object mapping table'),
'fields' => array(
'name' => array(
'description' => 'Foreign key for salesforce_field_map - the fieldmap that corresponds to this record.',
'type' => 'varchar',
'length' => 64,
),
'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. 000000000000000000)',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'drupal_type' => array(
'description' => 'Drupal object type (e.g. "node", "comment")',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'created' => array(
'description' => 'The UNIX timestamp when the mapping was created.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'last_import' => array(
'description' => 'The Unix timestamp when the record was last imported from Salesforce to Drupal.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'last_export' => array(
'description' => 'The Unix timestamp when the record was last exported from Drupal to Salesforce.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'indexes' => array(
'sfid' => array(
'sfid',
),
'name' => array(
'name',
),
),
'primary key' => array(
'drupal_type',
'oid',
),
);
// Salesforce Field Map schema
$schema['salesforce_field_map'] = array(
'description' => t('Drupal to Salesforce field mappings'),
'export' => array(
'key' => 'name',
'identifier' => 'salesforce_field_map',
'default hook' => 'default_salesforce_field_maps',
'export callback' => 'salesforce_api_salesforce_field_map_export',
'api' => array(
'owner' => 'salesforce_api',
'api' => 'salesforce_api',
'minimum_version' => 1,
'current_version' => 1,
),
),
'fields' => array(
// "name" field is only in schema for ctools exportable support and not in
// use via any UI at the moment. Implementing modules can assign
// meaningful names if they wish to do so, but it is not required for our
// purposes.
'fieldmap' => array(
'description' => 'The primary identifier for a fieldmap.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'no export' => TRUE,
),
'name' => array(
'description' => 'Unique ID for this object. Used to identify it programatically (initially implemented for ctools support only).',
'type' => 'varchar',
'length' => 64,
),
'automatic' => array(
'description' => 'Indicates whether this action/map is automatic or triggered.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => SALESFORCE_AUTO_SYNC_OFF,
'size' => 'small',
),
'drupal' => array(
'description' => 'The kind of Drupal object this map is for.',
'type' => 'varchar',
'length' => 40,
'not null' => TRUE,
'default' => '',
),
'salesforce' => array(
'description' => 'The kind of Salesforce object this map is for.',
'type' => 'varchar',
'length' => 32,
'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,
'serialize' => TRUE,
),
),
'primary key' => array(
'fieldmap',
),
'unique keys' => array(
'name' => array(
'name',
),
),
);
return $schema;
}