| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: poll.install,v 1.13.2.1 2009/01/06 15:46:37 goba Exp $ 3 4 /** 5 * Implementation of hook_install(). 6 */ 7 function poll_install() { 8 // Create tables. 9 drupal_install_schema('poll'); 10 } 11 12 /** 13 * Implementation of hook_uninstall(). 14 */ 15 function poll_uninstall() { 16 // Remove tables. 17 drupal_uninstall_schema('poll'); 18 } 19 20 /** 21 * Implementation of hook_schema(). 22 */ 23 function poll_schema() { 24 $schema['poll'] = array( 25 'description' => 'Stores poll-specific information for poll nodes.', 26 'fields' => array( 27 'nid' => array( 28 'type' => 'int', 29 'unsigned' => TRUE, 30 'not null' => TRUE, 31 'default' => 0, 32 'description' => "The poll's {node}.nid." 33 ), 34 'runtime' => array( 35 'type' => 'int', 36 'not null' => TRUE, 37 'default' => 0, 38 'description' => 'The number of seconds past {node}.created during which the poll is open.' 39 ), 40 'active' => array( 41 'type' => 'int', 42 'unsigned' => TRUE, 43 'not null' => TRUE, 44 'default' => 0, 45 'description' => 'Boolean indicating whether or not the poll is open.', 46 ), 47 ), 48 'primary key' => array('nid'), 49 ); 50 51 $schema['poll_choices'] = array( 52 'description' => 'Stores information about all choices for all {poll}s.', 53 'fields' => array( 54 'chid' => array( 55 'type' => 'serial', 56 'unsigned' => TRUE, 57 'not null' => TRUE, 58 'description' => 'Unique identifier for a poll choice.', 59 ), 60 'nid' => array( 61 'type' => 'int', 62 'unsigned' => TRUE, 63 'not null' => TRUE, 64 'default' => 0, 65 'description' => 'The {node}.nid this choice belongs to.', 66 ), 67 'chtext' => array( 68 'type' => 'varchar', 69 'length' => 128, 70 'not null' => TRUE, 71 'default' => '', 72 'description' => 'The text for this choice.', 73 ), 74 'chvotes' => array( 75 'type' => 'int', 76 'not null' => TRUE, 77 'default' => 0, 78 'description' => 'The total number of votes this choice has received by all users.', 79 ), 80 'chorder' => array( 81 'type' => 'int', 82 'not null' => TRUE, 83 'default' => 0, 84 'description' => 'The sort order of this choice among all choices for the same node.', 85 ) 86 ), 87 'indexes' => array( 88 'nid' => array('nid') 89 ), 90 'primary key' => array('chid'), 91 ); 92 93 $schema['poll_votes'] = array( 94 'description' => 'Stores per-{users} votes for each {poll}.', 95 'fields' => array( 96 'nid' => array( 97 'type' => 'int', 98 'unsigned' => TRUE, 99 'not null' => TRUE, 100 'description' => 'The {poll} node this vote is for.', 101 ), 102 'uid' => array( 103 'type' => 'int', 104 'unsigned' => TRUE, 105 'not null' => TRUE, 106 'default' => 0, 107 'description' => 'The {users}.uid this vote is from unless the voter was anonymous.', 108 ), 109 'chorder' => array( 110 'type' => 'int', 111 'not null' => TRUE, 112 'default' => -1, 113 'description' => "The {users}'s vote for this poll.", 114 ), 115 'hostname' => array( 116 'type' => 'varchar', 117 'length' => 128, 118 'not null' => TRUE, 119 'default' => '', 120 'description' => 'The IP address this vote is from unless the voter was logged in.', 121 ), 122 ), 123 'primary key' => array('nid', 'uid', 'hostname'), 124 'indexes' => array( 125 'hostname' => array('hostname'), 126 'uid' => array('uid'), 127 ), 128 ); 129 130 return $schema; 131 } 132
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |