| webmaster@1 | 1 <?php | 
| franck@19 | 2 // $Id: user.install,v 1.5.2.1 2009/01/06 15:46:38 goba Exp $ | 
| webmaster@1 | 3 | 
| webmaster@1 | 4 /** | 
| webmaster@1 | 5  * Implementation of hook_schema(). | 
| webmaster@1 | 6  */ | 
| webmaster@1 | 7 function user_schema() { | 
| webmaster@1 | 8   $schema['access'] = array( | 
| franck@19 | 9     'description' => 'Stores site access rules.', | 
| webmaster@1 | 10     'fields' => array( | 
| webmaster@1 | 11       'aid' => array( | 
| webmaster@1 | 12         'type' => 'serial', | 
| webmaster@1 | 13         'not null' => TRUE, | 
| franck@19 | 14         'description' => 'Primary Key: Unique access ID.', | 
| webmaster@1 | 15       ), | 
| webmaster@1 | 16       'mask' => array( | 
| webmaster@1 | 17         'type' => 'varchar', | 
| webmaster@1 | 18         'length' => 255, | 
| webmaster@1 | 19         'not null' => TRUE, | 
| webmaster@1 | 20         'default' => '', | 
| franck@19 | 21         'description' => 'Text mask used for filtering access.', | 
| webmaster@1 | 22       ), | 
| webmaster@1 | 23       'type' => array( | 
| webmaster@1 | 24         'type' => 'varchar', | 
| webmaster@1 | 25         'length' => 255, | 
| webmaster@1 | 26         'not null' => TRUE, | 
| webmaster@1 | 27         'default' => '', | 
| franck@19 | 28         'description' => 'Type of access rule: name, mail or host.', | 
| webmaster@1 | 29       ), | 
| webmaster@1 | 30       'status' => array( | 
| webmaster@1 | 31         'type' => 'int', | 
| webmaster@1 | 32         'not null' => TRUE, | 
| webmaster@1 | 33         'default' => 0, | 
| webmaster@1 | 34         'size' => 'tiny', | 
| franck@19 | 35         'description' => 'Whether rule is to allow(1) or deny(0) access.', | 
| webmaster@1 | 36       ), | 
| webmaster@1 | 37     ), | 
| webmaster@1 | 38     'primary key' => array('aid'), | 
| webmaster@1 | 39   ); | 
| webmaster@1 | 40 | 
| webmaster@1 | 41   $schema['authmap'] = array( | 
| franck@19 | 42     'description' => 'Stores distributed authentication mapping.', | 
| webmaster@1 | 43     'fields' => array( | 
| webmaster@1 | 44       'aid' => array( | 
| franck@19 | 45         'description' => 'Primary Key: Unique authmap ID.', | 
| webmaster@1 | 46         'type' => 'serial', | 
| webmaster@1 | 47         'unsigned' => TRUE, | 
| webmaster@1 | 48         'not null' => TRUE, | 
| webmaster@1 | 49       ), | 
| webmaster@1 | 50       'uid' => array( | 
| webmaster@1 | 51         'type' => 'int', | 
| webmaster@1 | 52         'not null' => TRUE, | 
| webmaster@1 | 53         'default' => 0, | 
| franck@19 | 54         'description' => "User's {users}.uid.", | 
| webmaster@1 | 55       ), | 
| webmaster@1 | 56       'authname' => array( | 
| webmaster@1 | 57         'type' => 'varchar', | 
| webmaster@1 | 58         'length' => 128, | 
| webmaster@1 | 59         'not null' => TRUE, | 
| webmaster@1 | 60         'default' => '', | 
| franck@19 | 61         'description' => 'Unique authentication name.', | 
| webmaster@1 | 62       ), | 
| webmaster@1 | 63       'module' => array( | 
| webmaster@1 | 64         'type' => 'varchar', | 
| webmaster@1 | 65         'length' => 128, | 
| webmaster@1 | 66         'not null' => TRUE, | 
| webmaster@1 | 67         'default' => '', | 
| franck@19 | 68         'description' => 'Module which is controlling the authentication.', | 
| webmaster@1 | 69       ), | 
| webmaster@1 | 70     ), | 
| webmaster@1 | 71     'unique keys' => array('authname' => array('authname')), | 
| webmaster@1 | 72     'primary key' => array('aid'), | 
| webmaster@1 | 73   ); | 
| webmaster@1 | 74 | 
| webmaster@1 | 75   $schema['permission'] = array( | 
| franck@19 | 76     'description' => 'Stores permissions for users.', | 
| webmaster@1 | 77     'fields' => array( | 
| webmaster@1 | 78       'pid' => array( | 
| webmaster@1 | 79         'type' => 'serial', | 
| webmaster@1 | 80         'not null' => TRUE, | 
| franck@19 | 81         'description' => 'Primary Key: Unique permission ID.', | 
| webmaster@1 | 82       ), | 
| webmaster@1 | 83       'rid' => array( | 
| webmaster@1 | 84         'type' => 'int', | 
| webmaster@1 | 85         'unsigned' => TRUE, | 
| webmaster@1 | 86         'not null' => TRUE, | 
| webmaster@1 | 87         'default' => 0, | 
| franck@19 | 88         'description' => 'The {role}.rid to which the permissions are assigned.', | 
| webmaster@1 | 89       ), | 
| webmaster@1 | 90       'perm' => array( | 
| webmaster@1 | 91         'type' => 'text', | 
| webmaster@1 | 92         'not null' => FALSE, | 
| webmaster@1 | 93         'size' => 'big', | 
| franck@19 | 94         'description' => 'List of permissions being assigned.', | 
| webmaster@1 | 95       ), | 
| webmaster@1 | 96       'tid' => array( | 
| webmaster@1 | 97         'type' => 'int', | 
| webmaster@1 | 98         'unsigned' => TRUE, | 
| webmaster@1 | 99         'not null' => TRUE, | 
| webmaster@1 | 100         'default' => 0, | 
| franck@19 | 101         'description' => 'Originally intended for taxonomy-based permissions, but never used.', | 
| webmaster@1 | 102       ), | 
| webmaster@1 | 103     ), | 
| webmaster@1 | 104     'primary key' => array('pid'), | 
| webmaster@1 | 105     'indexes' => array('rid' => array('rid')), | 
| webmaster@1 | 106   ); | 
| webmaster@1 | 107 | 
| webmaster@1 | 108   $schema['role'] = array( | 
| franck@19 | 109     'description' => 'Stores user roles.', | 
| webmaster@1 | 110     'fields' => array( | 
| webmaster@1 | 111       'rid' => array( | 
| webmaster@1 | 112         'type' => 'serial', | 
| webmaster@1 | 113         'unsigned' => TRUE, | 
| webmaster@1 | 114         'not null' => TRUE, | 
| franck@19 | 115         'description' => 'Primary Key: Unique role id.', | 
| webmaster@1 | 116       ), | 
| webmaster@1 | 117       'name' => array( | 
| webmaster@1 | 118         'type' => 'varchar', | 
| webmaster@1 | 119         'length' => 64, | 
| webmaster@1 | 120         'not null' => TRUE, | 
| webmaster@1 | 121         'default' => '', | 
| franck@19 | 122         'description' => 'Unique role name.', | 
| webmaster@1 | 123       ), | 
| webmaster@1 | 124     ), | 
| webmaster@1 | 125     'unique keys' => array('name' => array('name')), | 
| webmaster@1 | 126     'primary key' => array('rid'), | 
| webmaster@1 | 127   ); | 
| webmaster@1 | 128 | 
| webmaster@1 | 129   $schema['users'] = array( | 
| franck@19 | 130     'description' => 'Stores user data.', | 
| webmaster@1 | 131     'fields' => array( | 
| webmaster@1 | 132       'uid' => array( | 
| webmaster@1 | 133         'type' => 'serial', | 
| webmaster@1 | 134         'unsigned' => TRUE, | 
| webmaster@1 | 135         'not null' => TRUE, | 
| franck@19 | 136         'description' => 'Primary Key: Unique user ID.', | 
| webmaster@1 | 137       ), | 
| webmaster@1 | 138       'name' => array( | 
| webmaster@1 | 139         'type' => 'varchar', | 
| webmaster@1 | 140         'length' => 60, | 
| webmaster@1 | 141         'not null' => TRUE, | 
| webmaster@1 | 142         'default' => '', | 
| franck@19 | 143         'description' => 'Unique user name.', | 
| webmaster@1 | 144       ), | 
| webmaster@1 | 145       'pass' => array( | 
| webmaster@1 | 146         'type' => 'varchar', | 
| webmaster@1 | 147         'length' => 32, | 
| webmaster@1 | 148         'not null' => TRUE, | 
| webmaster@1 | 149         'default' => '', | 
| franck@19 | 150         'description' => "User's password (md5 hash).", | 
| webmaster@1 | 151       ), | 
| webmaster@1 | 152       'mail' => array( | 
| webmaster@1 | 153         'type' => 'varchar', | 
| webmaster@1 | 154         'length' => 64, | 
| webmaster@1 | 155         'not null' => FALSE, | 
| webmaster@1 | 156         'default' => '', | 
| franck@19 | 157         'description' => "User's email address.", | 
| webmaster@1 | 158       ), | 
| webmaster@1 | 159       'mode' => array( | 
| webmaster@1 | 160         'type' => 'int', | 
| webmaster@1 | 161         'not null' => TRUE, | 
| webmaster@1 | 162         'default' => 0, | 
| webmaster@1 | 163         'size' => 'tiny', | 
| franck@19 | 164         'description' => 'Per-user comment display mode (threaded vs. flat), used by the {comment} module.', | 
| webmaster@1 | 165       ), | 
| webmaster@1 | 166       'sort' => array( | 
| webmaster@1 | 167         'type' => 'int', | 
| webmaster@1 | 168         'not null' => FALSE, | 
| webmaster@1 | 169         'default' => 0, | 
| webmaster@1 | 170         'size' => 'tiny', | 
| franck@19 | 171         'description' => 'Per-user comment sort order (newest vs. oldest first), used by the {comment} module.', | 
| webmaster@1 | 172       ), | 
| webmaster@1 | 173       'threshold' => array( | 
| webmaster@1 | 174         'type' => 'int', | 
| webmaster@1 | 175         'not null' => FALSE, | 
| webmaster@1 | 176         'default' => 0, | 
| webmaster@1 | 177         'size' => 'tiny', | 
| franck@19 | 178         'description' => 'Previously used by the {comment} module for per-user preferences; no longer used.', | 
| webmaster@1 | 179       ), | 
| webmaster@1 | 180       'theme' => array( | 
| webmaster@1 | 181         'type' => 'varchar', | 
| webmaster@1 | 182         'length' => 255, | 
| webmaster@1 | 183         'not null' => TRUE, | 
| webmaster@1 | 184         'default' => '', | 
| franck@19 | 185         'description' => "User's default theme.", | 
| webmaster@1 | 186       ), | 
| webmaster@1 | 187       'signature' => array( | 
| webmaster@1 | 188         'type' => 'varchar', | 
| webmaster@1 | 189         'length' => 255, | 
| webmaster@1 | 190         'not null' => TRUE, | 
| webmaster@1 | 191         'default' => '', | 
| franck@19 | 192         'description' => "User's signature.", | 
| webmaster@1 | 193       ), | 
| webmaster@1 | 194       'created' => array( | 
| webmaster@1 | 195         'type' => 'int', | 
| webmaster@1 | 196         'not null' => TRUE, | 
| webmaster@1 | 197         'default' => 0, | 
| franck@19 | 198         'description' => 'Timestamp for when user was created.', | 
| webmaster@1 | 199       ), | 
| webmaster@1 | 200       'access' => array( | 
| webmaster@1 | 201         'type' => 'int', | 
| webmaster@1 | 202         'not null' => TRUE, | 
| webmaster@1 | 203         'default' => 0, | 
| franck@19 | 204         'description' => 'Timestamp for previous time user accessed the site.', | 
| webmaster@1 | 205       ), | 
| webmaster@1 | 206       'login' => array( | 
| webmaster@1 | 207         'type' => 'int', | 
| webmaster@1 | 208         'not null' => TRUE, | 
| webmaster@1 | 209         'default' => 0, | 
| franck@19 | 210         'description' => "Timestamp for user's last login.", | 
| webmaster@1 | 211       ), | 
| webmaster@1 | 212       'status' => array( | 
| webmaster@1 | 213         'type' => 'int', | 
| webmaster@1 | 214         'not null' => TRUE, | 
| webmaster@1 | 215         'default' => 0, | 
| webmaster@1 | 216         'size' => 'tiny', | 
| franck@19 | 217         'description' => 'Whether the user is active(1) or blocked(0).', | 
| webmaster@1 | 218       ), | 
| webmaster@1 | 219       'timezone' => array( | 
| webmaster@1 | 220         'type' => 'varchar', | 
| webmaster@1 | 221         'length' => 8, | 
| webmaster@1 | 222         'not null' => FALSE, | 
| franck@19 | 223         'description' => "User's timezone.", | 
| webmaster@1 | 224       ), | 
| webmaster@1 | 225       'language' => array( | 
| webmaster@1 | 226         'type' => 'varchar', | 
| webmaster@1 | 227         'length' => 12, | 
| webmaster@1 | 228         'not null' => TRUE, | 
| webmaster@1 | 229         'default' => '', | 
| franck@19 | 230         'description' => "User's default language.", | 
| webmaster@1 | 231       ), | 
| webmaster@1 | 232       'picture' => array( | 
| webmaster@1 | 233         'type' => 'varchar', | 
| webmaster@1 | 234         'length' => 255, | 
| webmaster@1 | 235         'not null' => TRUE, | 
| webmaster@1 | 236         'default' => '', | 
| franck@19 | 237         'description' => "Path to the user's uploaded picture.", | 
| webmaster@1 | 238       ), | 
| webmaster@1 | 239       'init' => array( | 
| webmaster@1 | 240         'type' => 'varchar', | 
| webmaster@1 | 241         'length' => 64, | 
| webmaster@1 | 242         'not null' => FALSE, | 
| webmaster@1 | 243         'default' => '', | 
| franck@19 | 244         'description' => 'Email address used for initial account creation.', | 
| webmaster@1 | 245       ), | 
| webmaster@1 | 246       'data' => array( | 
| webmaster@1 | 247         'type' => 'text', | 
| webmaster@1 | 248         'not null' => FALSE, | 
| webmaster@1 | 249         'size' => 'big', | 
| franck@19 | 250         'description' => 'A serialized array of name value pairs that are related to the user. Any form values posted during user edit are stored and are loaded into the $user object during user_load(). Use of this field is discouraged and it will likely disappear in a future version of Drupal.', | 
| webmaster@1 | 251       ), | 
| webmaster@1 | 252     ), | 
| webmaster@1 | 253     'indexes' => array( | 
| webmaster@1 | 254       'access' => array('access'), | 
| webmaster@1 | 255       'created' => array('created'), | 
| webmaster@1 | 256       'mail' => array('mail'), | 
| webmaster@1 | 257     ), | 
| webmaster@1 | 258     'unique keys' => array( | 
| webmaster@1 | 259       'name' => array('name'), | 
| webmaster@1 | 260     ), | 
| webmaster@1 | 261     'primary key' => array('uid'), | 
| webmaster@1 | 262   ); | 
| webmaster@1 | 263 | 
| webmaster@1 | 264   $schema['users_roles'] = array( | 
| franck@19 | 265     'description' => 'Maps users to roles.', | 
| webmaster@1 | 266     'fields' => array( | 
| webmaster@1 | 267       'uid' => array( | 
| webmaster@1 | 268         'type' => 'int', | 
| webmaster@1 | 269         'unsigned' => TRUE, | 
| webmaster@1 | 270         'not null' => TRUE, | 
| webmaster@1 | 271         'default' => 0, | 
| franck@19 | 272         'description' => 'Primary Key: {users}.uid for user.', | 
| webmaster@1 | 273       ), | 
| webmaster@1 | 274       'rid' => array( | 
| webmaster@1 | 275         'type' => 'int', | 
| webmaster@1 | 276         'unsigned' => TRUE, | 
| webmaster@1 | 277         'not null' => TRUE, | 
| webmaster@1 | 278         'default' => 0, | 
| franck@19 | 279         'description' => 'Primary Key: {role}.rid for role.', | 
| webmaster@1 | 280       ), | 
| webmaster@1 | 281     ), | 
| webmaster@1 | 282     'primary key' => array('uid', 'rid'), | 
| webmaster@1 | 283     'indexes' => array( | 
| webmaster@1 | 284       'rid' => array('rid'), | 
| webmaster@1 | 285     ), | 
| webmaster@1 | 286   ); | 
| webmaster@1 | 287 | 
| webmaster@1 | 288   return $schema; | 
| webmaster@1 | 289 } | 
| webmaster@1 | 290 |