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