function advpoll_schema in Advanced Poll 6
Same name and namespace in other branches
- 6.3 advpoll.install \advpoll_schema()
- 6.2 advpoll.install \advpoll_schema()
- 7.3 advpoll.install \advpoll_schema()
- 7 advpoll.install \advpoll_schema()
- 7.2 advpoll.install \advpoll_schema()
Implementation of hook_schema().
File
- ./
advpoll.install, line 19 - Manage database installation and upgrading for advpoll.
Code
function advpoll_schema() {
$schema = array();
$schema['advpoll'] = array(
'description' => t('Stores the main settings for an advanced poll node.'),
'fields' => array(
'nid' => array(
'description' => t("The advpoll's {node}.nid"),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'quorum' => array(
'description' => t('Quorum for the poll, currently unimplemented.'),
'type' => 'int',
'unsigned' => TRUE,
'default' => 0,
),
'mode' => array(
'description' => t('The type of poll, either ranking of binary.'),
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
),
'use_list' => array(
'description' => t('Whether or not an electoral list is being used.'),
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'active' => array(
'description' => t('Whether or not the poll is still open for voting.'),
'type' => 'int',
'not null' => TRUE,
'default' => 1,
),
'max_choices' => array(
'description' => t('An upper limit on how many choices can be selected.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'algorithm' => array(
'description' => t('Within a given voting mode, the formula used to calculate the poll winner.'),
'type' => 'varchar',
'length' => 100,
),
'show_votes' => array(
'description' => t('Whether or not to display votes that have been cast.'),
'type' => 'int',
'not null' => TRUE,
'default' => 1,
),
'start_date' => array(
'description' => t('The date at which voting begins for the poll.'),
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'end_date' => array(
'description' => t('The date at which voting ends for the poll.'),
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'writeins' => array(
'description' => t('Whether or not to allow write-in votes.'),
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'show_writeins' => array(
'description' => t('Whether or not to list write-in votes as possible choices.'),
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'question' => array(
'description' => t('Optional text to display as the subject of the poll.'),
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
),
'primary key' => array(
'nid',
),
);
$schema['advpoll_electoral_list'] = array(
'description' => t('Stores the list of eligible votes for polls that use an electoral list.'),
'fields' => array(
'nid' => array(
'description' => t('Node id for the relevant advpoll.'),
'type' => 'int',
'not null' => TRUE,
),
'uid' => array(
'description' => t('User id who will be given access to vote in an advpoll.'),
'type' => 'int',
'not null' => TRUE,
),
),
'primary key' => array(
'nid',
'uid',
),
);
$schema['advpoll_choices'] = array(
'description' => t('Stores the settings for an individual choice in a poll.'),
'fields' => array(
'cid' => array(
'description' => t('The unique id of the choice.'),
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'nid' => array(
'description' => t('The choice is assigned to this advpoll node.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'label' => array(
'description' => t('A string description of what this choice represents.'),
'type' => 'text',
'not null' => TRUE,
),
'weight' => array(
'description' => t('An integer value used to order the display of choices from lowest to highest.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'writein' => array(
'description' => t('Whether or not this choice was a write-in vote by a user.'),
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'indexes' => array(
'nid' => array(
'nid',
'weight',
),
),
'primary key' => array(
'cid',
),
);
return $schema;
}