You are here

function webform_civicrm_schema in Webform CiviCRM Integration 7.2

Same name and namespace in other branches
  1. 8.5 webform_civicrm.install \webform_civicrm_schema()
  2. 6.2 webform_civicrm.install \webform_civicrm_schema()
  3. 6 webform_civicrm.install \webform_civicrm_schema()
  4. 7.5 webform_civicrm.install \webform_civicrm_schema()
  5. 7 webform_civicrm.install \webform_civicrm_schema()
  6. 7.3 webform_civicrm.install \webform_civicrm_schema()
  7. 7.4 webform_civicrm.install \webform_civicrm_schema()

Implements hook_schema().

File

./webform_civicrm.install, line 11
Webform CiviCRM module's install, uninstall and upgrade code.

Code

function webform_civicrm_schema() {
  $schema = array();
  $schema['webform_civicrm_forms'] = array(
    'description' => 'CiviCRM settings for individual Webform nodes.',
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Webform Node ID',
      ),
      'data' => array(
        'type' => 'text',
        'serialize' => TRUE,
        'description' => 'Array of entity data for this webform',
      ),
      'prefix_known' => array(
        'description' => 'Form prefix for known users.',
        'type' => 'text',
        'not null' => TRUE,
      ),
      'prefix_unknown' => array(
        'description' => 'Form prefix for unknown users.',
        'type' => 'text',
        'not null' => TRUE,
      ),
      'message' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Message to show to known users',
      ),
      'confirm_subscription' => array(
        'description' => 'Send confirmation for mailing list subscriptions.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'block_unknown_users' => array(
        'description' => 'Only allow known contacts to use form.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'create_fieldsets' => array(
        'description' => 'Add fieldsets around contacts.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'new_contact_source' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Source label for newly created contacts',
      ),
      'contact_matching' => array(
        'description' => 'How to match and autofill for contacts',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 1,
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  $schema['webform_civicrm_submissions'] = array(
    'description' => 'Link between form submissions and CiviCRM contacts.',
    'fields' => array(
      'sid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Webform Submission ID',
      ),
      'contact_id' => array(
        'type' => 'varchar',
        'length' => 2000,
        'not null' => TRUE,
        'default' => '',
        'description' => 'CiviCRM contact ids from this submission',
      ),
      'activity_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'FK to {civicrm_activity} id',
      ),
    ),
    'primary key' => array(
      'sid',
    ),
  );
  return $schema;
}