You are here

sf_queue.install in Salesforce Suite 7.2

Same filename and directory in other branches
  1. 6.2 sf_queue/sf_queue.install

Install file for the Salesforce Export Queue module.

File

sf_queue/sf_queue.install
View source
<?php

/**
 * @file
 *
 * Install file for the Salesforce Export Queue module.
 */

/**
 * Implements hook_install().
 */
function sf_queue_install() {

  // TODO The drupal_(un)install_schema functions are called automatically in D7.
  // drupal_install_schema('sf_queue')
}

/**
 * Implements hook_uninstall().
 */
function sf_queue_uninstall() {

  // TODO The drupal_(un)install_schema functions are called automatically in D7.
  // drupal_uninstall_schema('sf_queue')
  // TODO Please review the conversion of this statement to the D7 database API syntax.

  /* db_query("DELETE FROM {variable} WHERE {name} LIKE 'sf_queue_%'") */
  db_delete('variable')
    ->condition('{name}', 'sf_queue_%', 'LIKE')
    ->execute();
}

/**
 * Implements hook_disable().
 */
function sf_queue_disable() {
  sf_queue_process_queue_force(FALSE);
}

/**
 * Implements hook_schema().
 *
 */
function sf_queue_schema() {
  $schema['salesforce_export_queue'] = array(
    'description' => 'Salesforce objects queued for export',
    'fields' => array(
      'sf_op' => array(
        'description' => 'The Salesforce export operation: "create", "update", or "delete"',
        'type' => 'varchar',
        'length' => 8,
        'not null' => TRUE,
        'default' => '',
      ),
      'id' => array(
        'description' => 'Primary key for this table.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'no export' => TRUE,
      ),
      'oid' => array(
        'description' => 'Specific Drupal object identifier (e.g. node id or user id)',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'attempts' => array(
        'description' => 'How many export attempts have been made for this record.',
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'created' => array(
        'description' => 'Unix timestamp for this record\'s creation date',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'sfid' => array(
        'description' => 'Salesforce object identifier, if applicable (e.g. "node", "comment")',
        'type' => 'varchar',
        'length' => 32,
        'not null' => FALSE,
        'default' => '',
      ),
      'drupal_type' => array(
        'description' => 'Drupal object type (e.g. "node", "comment")',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'sf_type' => array(
        'description' => 'Salesforce object type (e.g. "node", "comment")',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'name' => array(
        'description' => 'Unique ID for this object. Used to identify it programatically.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'fieldmap_name' => array(
        'description' => 'Foreign key for salesforce_field_map - the fieldmap that corresponds to this record.',
        'type' => 'varchar',
        'length' => 64,
      ),
      'sf_data' => array(
        'description' => 'Serialized Salesforce object data',
        'type' => 'text',
        'not null' => TRUE,
        'serialize' => TRUE,
      ),
    ),
    'indexes' => array(
      'drupal_type' => array(
        'drupal_type',
      ),
      'sf_type' => array(
        'sf_type',
      ),
      'sf_op' => array(
        'sf_op',
      ),
      'created' => array(
        'created',
      ),
      'fieldmap_drupal' => array(
        'fieldmap_name',
        'drupal_type',
      ),
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  return $schema;
}

/**
 * @todo Please document this function.
 * @see http://drupal.org/node/1354
 */
function sf_queue_update_6201() {
  $ret = array();
  $schema = drupal_get_schema('salesforce_export_queue');
  if (isset($schema['unique keys']['fieldmap_drupal'])) {
    db_drop_unique_key('salesforce_export_queue', 'fieldmap_drupal');
  }
  if (!isset($schema['indexes']['fieldmap_drupal'])) {
    db_add_index('salesforce_export_queue', 'fieldmap_drupal', array(
      'fieldmap_name',
      'drupal_type',
    ));
  }

  // hook_update_N() no longer returns a $ret array. Instead, return
  // nothing or a translated string indicating the update ran successfully.
  // See http://drupal.org/node/224333#update_sql.
  return t('TODO Add a descriptive string here to show in the UI.');
}

Functions

Namesort descending Description
sf_queue_disable Implements hook_disable().
sf_queue_install Implements hook_install().
sf_queue_schema Implements hook_schema().
sf_queue_uninstall Implements hook_uninstall().
sf_queue_update_6201 @todo Please document this function.