Code coverage for /20081101/modules/poll/poll.install

Line #Times calledCode
1
<?php
2
// $Id: poll.install,v 1.15 2008/05/15 20:55:58 dries Exp $
3
4
/**
5
 * Implementation of hook_install().
6
 */
74
function poll_install() {
8
  // Create tables.
93
  drupal_install_schema('poll');
103
}
11
12
/**
13
 * Implementation of hook_uninstall().
14
 */
154
function poll_uninstall() {
16
  // Remove tables.
170
  drupal_uninstall_schema('poll');
180
}
19
20
/**
21
 * Implementation of hook_schema().
22
 */
234
function poll_schema() {
243
  $schema['poll'] = array(
253
    'description' => t('Stores poll-specific information for poll nodes.'),
26
    'fields' => array(
27
      'nid' => array(
283
        'type' => 'int',
293
        'unsigned' => TRUE,
303
        'not null' => TRUE,
313
        'default' => 0,
323
        'description' => t("The poll's {node}.nid."),
333
      ),
34
      'runtime' => array(
353
        'type' => 'int',
363
        'not null' => TRUE,
373
        'default' => 0,
383
        'description' => t('The number of seconds past {node}.created
during which the poll is open.'),
393
      ),
40
      'active' => array(
413
        'type' => 'int',
423
        'unsigned' => TRUE,
433
        'not null' => TRUE,
443
        'default' => 0,
453
        'description' => t('Boolean indicating whether or not the poll is
open.'),
463
      ),
473
    ),
483
    'primary key' => array('nid'),
49
  );
50
513
  $schema['poll_choices'] = array(
523
    'description' => t('Stores information about all choices for all
{poll}s.'),
53
    'fields' => array(
54
      'chid' => array(
553
        'type' => 'serial',
563
        'unsigned' => TRUE,
573
        'not null' => TRUE,
583
        'description' => t('Unique identifier for a poll choice.'),
593
      ),
60
      'nid' => array(
613
        'type' => 'int',
623
        'unsigned' => TRUE,
633
        'not null' => TRUE,
643
        'default' => 0,
653
        'description' => t('The {node}.nid this choice belongs to.'),
663
      ),
67
      'chtext' => array(
683
        'type' => 'varchar',
693
        'length' => 128,
703
        'not null' => TRUE,
713
        'default' => '',
723
        'description' => t('The text for this choice.'),
733
      ),
74
      'chvotes' => array(
753
        'type' => 'int',
763
        'not null' => TRUE,
773
        'default' => 0,
783
        'description' => t('The total number of votes this choice has
received by all users.'),
793
      ),
80
      'weight' => array(
813
        'type' => 'int',
823
        'size' => 'tiny',
833
        'not null' => TRUE,
843
        'default' => 0,
853
        'description' => t('The sort order of this choice among all choices
for the same node.'),
863
      ),
873
    ),
88
    'indexes' => array(
893
      'nid' => array('nid'),
903
    ),
913
    'primary key' => array('chid'),
92
  );
93
943
  $schema['poll_votes'] = array(
953
    'description' => t('Stores per-{users} votes for each {poll}.'),
96
    'fields' => array(
97
      'chid' => array(
983
        'type' => 'int',
993
        'unsigned' => TRUE,
1003
        'not null' => TRUE,
1013
        'description' => t("The {users}'s vote for this poll."),
1023
      ),
103
      'nid' => array(
1043
        'type' => 'int',
1053
        'unsigned' => TRUE,
1063
        'not null' => TRUE,
1073
        'description' => t('The {poll} node this vote is for.'),
1083
      ),
109
      'uid' => array(
1103
        'type' => 'int',
1113
        'unsigned' => TRUE,
1123
        'not null' => TRUE,
1133
        'default' => 0,
1143
        'description' => t('The {users}.uid this vote is from unless the
voter was anonymous.'),
1153
      ),
116
      'hostname' => array(
1173
        'type' => 'varchar',
1183
        'length' => 128,
1193
        'not null' => TRUE,
1203
        'default' => '',
1213
        'description' => t('The IP address this vote is from unless the
voter was logged in.'),
1223
      ),
1233
    ),
1243
    'primary key' => array('nid', 'uid', 'hostname'),
125
    'indexes' => array(
1263
      'chid'     => array('chid'),
1273
      'hostname' => array('hostname'),
1283
      'uid' => array('uid'),
1293
    ),
130
  );
131
1323
  return $schema;
1330
}
1344