flexiform_webform.install in Flexiform 7
Sets up the base table for our entity and a table to store information about the entity types.
File
flexiform_webform/flexiform_webform.installView source
<?php
/**
* @file
* Sets up the base table for our entity and a table to store information about
* the entity types.
*/
/**
* Implements hook_schema().
*/
function flexiform_webform_schema() {
$schema = array();
$schema['flexiform_webform'] = array(
'description' => 'The base table for flexiform_webform entities',
'fields' => array(
'id' => array(
'description' => 'Primary Key: Identifier for a flexiform_webform.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'webform' => array(
'description' => 'The machine-readable webform of this flexiform_webform.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'label' => array(
'description' => 'The human-readable name of this flexiform_webform.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'form_group' => array(
'description' => 'The group that this flexiform webform belongs to.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => 'general',
),
'data' => array(
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
'description' => 'A serialized array of additional data related to this webform.',
),
'status' => array(
'type' => 'int',
'not null' => TRUE,
// Set the default to ENTITY_CUSTOM without using the constant as it is
// not safe to use it at this point.
'default' => 0x1,
'size' => 'tiny',
'description' => 'The exportable status of the entity.',
),
'module' => array(
'description' => 'The name of the providing module if the entity has been defined in code.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
),
'primary key' => array(
'id',
),
'unique keys' => array(
'webform' => array(
'webform',
),
),
);
$schema['flexiform_webform_submission'] = array(
'description' => 'The base table for flexiform_webform_submission entities.',
'fields' => array(
'id' => array(
'description' => 'Primary Key: Identifier for a flexiform_webform_submission.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'webform' => array(
'description' => 'The {flexiform_webform}.webform of this flexiform_submission.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'language' => array(
'description' => 'The language of the flexiform_submission.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'created' => array(
'description' => 'The Unix timestamp when the flexiform_submission was created.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'changed' => array(
'description' => 'The Unix timestamp when the flexiform_submission was most recently saved.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'user' => array(
'description' => 'The User whoe created this submission',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'id',
),
'indexes' => array(
'webform' => array(
'webform',
),
),
);
return $schema;
}
/**
* Add form group column.
*/
function flexiform_webform_update_7001() {
$spec = array(
'description' => 'The group that this flexiform webform belongs to.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => 'general',
);
$keys = array(
'indexes' => array(
'form_group' => array(
'form_group',
),
),
);
db_add_field('flexiform_webform', 'form_group', $spec, $keys);
}
Functions
Name | Description |
---|---|
flexiform_webform_schema | Implements hook_schema(). |
flexiform_webform_update_7001 | Add form group column. |