| 
webmaster@1
 | 
     1 <?php | 
| 
webmaster@1
 | 
     2 // $Id: user.install,v 1.5 2008/01/08 07:46:41 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( | 
| 
webmaster@1
 | 
     9     'description' => t('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, | 
| 
webmaster@1
 | 
    14         'description' => t('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' => '', | 
| 
webmaster@1
 | 
    21         'description' => t('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' => '', | 
| 
webmaster@1
 | 
    28         'description' => t('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', | 
| 
webmaster@1
 | 
    35         'description' => t('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( | 
| 
webmaster@1
 | 
    42     'description' => t('Stores distributed authentication mapping.'), | 
| 
webmaster@1
 | 
    43     'fields' => array( | 
| 
webmaster@1
 | 
    44       'aid' => array( | 
| 
webmaster@1
 | 
    45         'description' => t('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, | 
| 
webmaster@1
 | 
    54         'description' => t("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' => '', | 
| 
webmaster@1
 | 
    61         'description' => t('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' => '', | 
| 
webmaster@1
 | 
    68         'description' => t('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( | 
| 
webmaster@1
 | 
    76     'description' => t('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, | 
| 
webmaster@1
 | 
    81         'description' => t('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, | 
| 
webmaster@1
 | 
    88         'description' => t('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', | 
| 
webmaster@1
 | 
    94         'description' => t('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, | 
| 
webmaster@1
 | 
   101         'description' => t('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( | 
| 
webmaster@1
 | 
   109     'description' => t('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, | 
| 
webmaster@1
 | 
   115         'description' => t('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' => '', | 
| 
webmaster@1
 | 
   122         'description' => t('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( | 
| 
webmaster@1
 | 
   130     'description' => t('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, | 
| 
webmaster@1
 | 
   136         'description' => t('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' => '', | 
| 
webmaster@1
 | 
   143         'description' => t('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' => '', | 
| 
webmaster@1
 | 
   150         'description' => t("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' => '', | 
| 
webmaster@1
 | 
   157         'description' => t("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', | 
| 
webmaster@1
 | 
   164         'description' => t('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', | 
| 
webmaster@1
 | 
   171         'description' => t('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', | 
| 
webmaster@1
 | 
   178         'description' => t('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' => '', | 
| 
webmaster@1
 | 
   185         'description' => t("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' => '', | 
| 
webmaster@1
 | 
   192         'description' => t("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, | 
| 
webmaster@1
 | 
   198         'description' => t('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, | 
| 
webmaster@1
 | 
   204         'description' => t('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, | 
| 
webmaster@1
 | 
   210         'description' => t("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', | 
| 
webmaster@1
 | 
   217         'description' => t('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, | 
| 
webmaster@1
 | 
   223         'description' => t("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' => '', | 
| 
webmaster@1
 | 
   230         'description' => t("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' => '', | 
| 
webmaster@1
 | 
   237         'description' => t("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' => '', | 
| 
webmaster@1
 | 
   244         'description' => t('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', | 
| 
webmaster@1
 | 
   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.'), | 
| 
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( | 
| 
webmaster@1
 | 
   265     'description' => t('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, | 
| 
webmaster@1
 | 
   272         'description' => t('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, | 
| 
webmaster@1
 | 
   279         'description' => t('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  |