function webform_schema in Webform 6.3
Same name and namespace in other branches
- 8.5 webform.install \webform_schema()
- 6.2 webform.install \webform_schema()
- 7.4 webform.install \webform_schema()
- 7.3 webform.install \webform_schema()
- 6.x webform.install \webform_schema()
Implements hook_schema().
File
- ./
webform.install, line 11 - Webform module install/schema hooks.
Code
function webform_schema() {
$schema = array();
$schema['webform'] = array(
'description' => 'Table for storing additional properties for webform nodes.',
'fields' => array(
'nid' => array(
'description' => 'The node identifier of a webform.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'confirmation' => array(
'description' => 'The confirmation message or URL displayed to the user after submitting a form.',
'type' => 'text',
'not null' => TRUE,
),
'confirmation_format' => array(
'description' => 'The input format used by the confirmation message.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'redirect_url' => array(
'description' => 'The URL a user is redirected to after submitting a form.',
'type' => 'varchar',
'length' => 255,
'default' => '<confirmation>',
),
'status' => array(
'description' => 'Boolean value of a webform for open (1) or closed (0).',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 1,
),
'block' => array(
'description' => 'Boolean value for whether this form be available as a block.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'teaser' => array(
'description' => 'Boolean value for whether the entire form should be displayed on the teaser.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'allow_draft' => array(
'description' => 'Boolean value for whether submissions to this form be saved as a draft.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'auto_save' => array(
'description' => 'Boolean value for whether submissions to this form should be auto-saved between pages.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'submit_notice' => array(
'description' => 'Boolean value for whether to show or hide the previous submissions notification.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 1,
),
'submit_text' => array(
'description' => 'The title of the submit button on the form.',
'type' => 'varchar',
'length' => 255,
),
'submit_limit' => array(
'description' => 'The number of submissions a single user is allowed to submit within an interval. -1 is unlimited.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => -1,
),
'submit_interval' => array(
'description' => 'The amount of time in seconds that must pass before a user can submit another submission within the set limit.',
'type' => 'int',
'not null' => TRUE,
'default' => -1,
),
'total_submit_limit' => array(
'description' => 'The total number of submissions allowed within an interval. -1 is unlimited.',
'type' => 'int',
'not null' => TRUE,
'default' => -1,
),
'total_submit_interval' => array(
'description' => 'The amount of time in seconds that must pass before another submission can be submitted within the set limit.',
'type' => 'int',
'not null' => TRUE,
'default' => -1,
),
),
'primary key' => array(
'nid',
),
);
$schema['webform_component'] = array(
'description' => 'Stores information about components for webform nodes.',
'fields' => array(
'nid' => array(
'description' => 'The node identifier of a webform.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'cid' => array(
'description' => 'The identifier for this component within this node, starts at 0 for each node.',
'type' => 'int',
'size' => 'small',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'pid' => array(
'description' => 'If this component has a parent fieldset, the cid of that component.',
'type' => 'int',
'size' => 'small',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'form_key' => array(
'description' => 'When the form is displayed and processed, this key can be used to reference the results.',
'type' => 'varchar',
'length' => 128,
),
'name' => array(
'description' => 'The label for this component.',
'type' => 'varchar',
'length' => 255,
),
'type' => array(
'description' => 'The field type of this component (textfield, select, hidden, etc.).',
'type' => 'varchar',
'length' => 16,
),
'value' => array(
'description' => 'The default value of the component when displayed to the end-user.',
'type' => 'text',
'not null' => TRUE,
),
'extra' => array(
'description' => 'Additional information unique to the display or processing of this component.',
'type' => 'text',
'not null' => TRUE,
),
'mandatory' => array(
'description' => 'Boolean flag for if this component is required.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'weight' => array(
'description' => 'Determines the position of this component in the form.',
'type' => 'int',
'size' => 'small',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'nid',
'cid',
),
);
$schema['webform_emails'] = array(
'description' => 'Holds information regarding e-mails that should be sent upon submitting a webform',
'fields' => array(
'nid' => array(
'description' => 'The node identifier of a webform.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'eid' => array(
'description' => 'The e-mail identifier for this row\'s settings.',
'type' => 'int',
'unsigned' => TRUE,
'size' => 'small',
'not null' => TRUE,
'default' => 0,
),
'email' => array(
'description' => 'The e-mail address that will be sent to upon submission. This may be an e-mail address, the special key "default" or a numeric value. If a numeric value is used, the value of a component will be substituted on submission.',
'type' => 'text',
'not null' => FALSE,
),
'subject' => array(
'description' => 'The e-mail subject that will be used. This may be a string, the special key "default" or a numeric value. If a numeric value is used, the value of a component will be substituted on submission.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'from_name' => array(
'description' => 'The e-mail "from" name that will be used. This may be a string, the special key "default" or a numeric value. If a numeric value is used, the value of a component will be substituted on submission.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'from_address' => array(
'description' => 'The e-mail "from" e-mail address that will be used. This may be a string, the special key "default" or a numeric value. If a numeric value is used, the value of a component will be substituted on submission.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'template' => array(
'description' => 'A template that will be used for the sent e-mail. This may be a string or the special key "default", which will use the template provided by the theming layer.',
'type' => 'text',
'not null' => FALSE,
),
'excluded_components' => array(
'description' => 'A list of components that will not be included in the %email_values token. A list of CIDs separated by commas.',
'type' => 'text',
'not null' => TRUE,
),
'html' => array(
'description' => 'Determines if the e-mail will be sent in an HTML format. Requires Mime Mail module.',
'type' => 'int',
'unsigned' => TRUE,
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'attachments' => array(
'description' => 'Determines if the e-mail will include file attachments. Requires Mime Mail module.',
'type' => 'int',
'unsigned' => TRUE,
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'nid',
'eid',
),
);
$schema['webform_roles'] = array(
'description' => 'Holds access information regarding which roles are allowed to submit which webform nodes. Does not prevent access to the webform node entirely, use the {node_access} table for that purpose.',
'fields' => array(
'nid' => array(
'description' => 'The node identifier of a webform.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'rid' => array(
'description' => 'The role identifier.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'nid',
'rid',
),
);
$schema['webform_submissions'] = array(
'description' => 'Holds general information about submissions outside of field values.',
'fields' => array(
'sid' => array(
'description' => 'The unique identifier for this submission.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'nid' => array(
'description' => 'The node identifier of a webform.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'uid' => array(
'description' => 'The id of the user that completed this submission.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'is_draft' => array(
'description' => 'Is this a draft of the submission?',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'submitted' => array(
'description' => 'Timestamp of when the form was submitted.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'remote_addr' => array(
'description' => 'The IP address of the user that submitted the form.',
'type' => 'varchar',
'length' => 128,
),
),
'primary key' => array(
'sid',
),
'unique keys' => array(
'sid_nid' => array(
'sid',
'nid',
),
),
'indexes' => array(
'nid_uid_sid' => array(
'nid',
'uid',
'sid',
),
'nid_sid' => array(
'nid',
'sid',
),
),
);
$schema['webform_submitted_data'] = array(
'description' => 'Stores all submitted field data for webform submissions.',
'fields' => array(
'nid' => array(
'description' => 'The node identifier of a webform.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'sid' => array(
'description' => 'The unique identifier for this submission.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'cid' => array(
'description' => 'The identifier for this component within this node, starts at 0 for each node.',
'type' => 'int',
'size' => 'small',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'no' => array(
'description' => 'Usually this value is 0, but if a field has multiple values (such as a time or date), it may require multiple rows in the database.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '0',
),
'data' => array(
'description' => 'The submitted value of this field, may be serialized for some components.',
'type' => 'text',
'size' => 'medium',
'not null' => TRUE,
),
),
'primary key' => array(
'nid',
'sid',
'cid',
'no',
),
'indexes' => array(
'nid' => array(
'nid',
),
'sid_nid' => array(
'sid',
'nid',
),
),
);
$schema['webform_last_download'] = array(
'description' => 'Stores last submission number per user download.',
'fields' => array(
'nid' => array(
'description' => 'The node identifier of a webform.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'uid' => array(
'description' => 'The user identifier.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'sid' => array(
'description' => 'The last downloaded submission number.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'requested' => array(
'description' => 'Timestamp of last download request.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'nid',
'uid',
),
);
return $schema;
}