You are here

function webform_civicrm_schema in Webform CiviCRM Integration 8.5

Same name and namespace in other branches
  1. 6.2 webform_civicrm.install \webform_civicrm_schema()
  2. 6 webform_civicrm.install \webform_civicrm_schema()
  3. 7.5 webform_civicrm.install \webform_civicrm_schema()
  4. 7 webform_civicrm.install \webform_civicrm_schema()
  5. 7.2 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 46
Webform CiviCRM module's install, uninstall and upgrade code.

Code

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