Skip to content
poll.install 3.99 KiB
Newer Older
 * Install, update and uninstall functions for the poll module.
 */
function poll_schema() {
  $schema['poll'] = array(
    'description' => 'Stores poll-specific information for poll nodes.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => "The poll's {node}.nid.",
      'runtime' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The number of seconds past {node}.created during which the poll is open.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Boolean indicating whether or not the poll is open.',
      'poll_node' => array(
        'table' => 'node',
        'columns' => array('nid' => 'nid'),
      ),
    'description' => 'Stores information about all choices for all {poll}s.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Unique identifier for a poll choice.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The {node}.nid this choice belongs to.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The text for this choice.',
      'chvotes' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The total number of votes this choice has received by all users.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The sort order of this choice among all choices for the same node.',
      'choice_node' => array(
        'table' => 'node',
        'columns' => array('nid' => 'nid'),
      ),
    'description' => 'Stores per-{users} votes for each {poll}.',
      'chid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => "The {users}'s vote for this poll.",
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The {poll} node this vote is for.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The {users}.uid this vote is from unless the voter was anonymous.',
      'hostname' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The IP address this vote is from unless the voter was logged in.',
      'timestamp' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The timestamp of the vote creation.',
      ),
    'primary key' => array('nid', 'uid', 'hostname'),
      'poll_node' => array(
        'table' => 'node',
        'columns' => array('nid' => 'nid'),
      ),
      'voter' => array(
        'table' => 'users',
        'columns' => array('uid' => 'uid'),
      ),