You are here

webform_remote_post.install in Webform Remote Post 6

Same filename and directory in other branches
  1. 7.2 webform_remote_post.install
  2. 7 webform_remote_post.install

Module install/schema hooks.

File

webform_remote_post.install
View source
<?php

/**
 * @file
 * Module install/schema hooks.
 */

/**
 * Implements hook_schema().
 */
function webform_remote_post_schema() {
  $schema = array();
  $schema['webform_remote_post_targets'] = array(
    'description' => 'Holds information regarding submission forwards that should be sent for each valid form submission',
    'fields' => array(
      'nid' => array(
        'description' => 'The node identifier of a webform.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'tid' => array(
        'description' => 'The URL target identifier.',
        'type' => 'serial',
      ),
      'url' => array(
        'description' => 'The http address that will be used to post upon submission.',
        'type' => 'text',
        'not null' => TRUE,
      ),
      'label' => array(
        'description' => 'The label given to the URL target that we are posting to.',
        'type' => 'text',
        'not null' => FALSE,
      ),
      'enabled' => array(
        'description' => 'Should we post to this target?',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 1,
      ),
      'type' => array(
        'description' => 'The type of content to send remotely.',
        'type' => 'text',
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'nid',
      'tid',
    ),
    'indexes' => array(
      'nid' => array(
        'nid',
      ),
      'tid' => array(
        'tid',
      ),
      'nid_tid' => array(
        'nid',
        ' tid',
      ),
    ),
  );
  return $schema;
}

/**
 * Implements hook_install().
 */
function webform_remote_post_install() {
  drupal_install_schema('webform_remote_post');
}

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

  // Drop tables.
  drupal_uninstall_schema('webform_remote_post');
}