summaryrefslogtreecommitdiff
path: root/modules/poll/poll.schema
blob: 7a9a355095ae0f749da67778fea998327d43d3d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
// $Id$

function poll_schema() {
  $schema['poll'] = array(
    'fields' => array(
      'nid'     => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
      'runtime' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'active'  => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)
    ),
    'primary key' => array('nid'),
  );

  $schema['poll_choices'] = array(
    'fields' => array(
      'chid'    => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
      'nid'     => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
      'chtext'  => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
      'chvotes' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'chorder' => array('type' => 'int', 'not null' => TRUE, 'default' => 0)
    ),
    'indexes' => array('nid' => array('nid')),
    'primary key' => array('chid'),
  );

  $schema['poll_votes'] = array(
    'fields' => array(
      'nid'      => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE),
      'uid'      => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
      'chorder'  => array('type' => 'int', 'not null' => TRUE, 'default' => -1),
      'hostname' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => '')
    ),
    'indexes' => array(
      'hostname' => array('hostname'),
      'nid'      => array('nid'),
      'uid'      => array('uid')
    ),
  );

  return $schema;
}