You are here

sf_queue.install in Salesforce Suite 6.2

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

File

sf_queue/sf_queue.install
View source
<?php

// $Id$

/**
 * @file
 */

/**
 * Implementation of hook_install().
 */
function sf_queue_install() {
  drupal_install_schema('sf_queue');
}

/**
 * Implementation of hook_uninstall().
 */
function sf_queue_uninstall() {
  drupal_uninstall_schema('sf_queue');
  db_query("DELETE FROM {variable} WHERE {name} LIKE 'sf_queue_%'");
}

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

/**
 * Implementation of hook_schema()
 *
 */
function sf_queue_schema() {
  $schema['salesforce_export_queue'] = array(
    'description' => t('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;
}
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($ret, 'salesforce_export_queue', 'fieldmap_drupal');
  }
  if (!isset($schema['indexes']['fieldmap_drupal'])) {
    db_add_index($ret, 'salesforce_export_queue', 'fieldmap_drupal', array(
      'fieldmap_name',
      'drupal_type',
    ));
  }
  return $ret;
}

Functions

Namesort descending Description
sf_queue_disable Implementation of hook_disable().
sf_queue_install Implementation of hook_install().
sf_queue_schema Implementation of hook_schema()
sf_queue_uninstall Implementation of hook_uninstall().
sf_queue_update_6201