You are here

sf_import.install in Salesforce Suite 6.2

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

Install functions for Salesforce Import

File

sf_import/sf_import.install
View source
<?php

/**
 * @file
 *  Install functions for Salesforce Import
 */

/**
 * Implements hook_schema().
 */
function sf_import_schema() {
  $schema['sf_import_queue'] = array(
    'description' => t('Contains data for importing Salesforce records'),
    'fields' => array(
      'sfid' => array(
        'description' => t('The Salesforce ID of an updated object'),
        'type' => 'varchar',
        'length' => '32',
        'not null' => TRUE,
      ),
      'time' => array(
        'description' => t('The timestamp that this object was imported'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'fieldmap' => array(
        'description' => t('The fieldmap to use for importing'),
        'type' => 'varchar',
        'length' => '64',
        'not null' => TRUE,
      ),
    ),
    'indexes' => array(
      'sfid' => array(
        'sfid',
      ),
      'fieldmap' => array(
        'fieldmap',
      ),
    ),
    'primary key' => array(
      'sfid',
    ),
  );
  return $schema;
}

/**
 * Implements hook_install().
 */
function sf_import_install() {
  drupal_install_schema('sf_import');
  variable_set('sf_import_fieldmaps', salesforce_api_salesforce_field_map_load_all());
  variable_set('sf_import_queue_processed_count', 0);
  variable_set('sf_import_queue_import_count', 0);
}

/**
 * Implements hook_uninstall().
 */
function sf_import_uninstall() {
  drupal_uninstall_schema('sf_import');
  db_query("DELETE FROM {variable} WHERE {name} LIKE 'sf_import%'");
}

/**
 * Implements hook_update_N().
 */
function sf_import_update_6200(&$sandbox) {

  // Since sf_import has been broken out into several files
  // clearing the cache is necessary.
  cache_clear_all();
}

Functions