2007-10-05 16:07:22 +00:00
<?php
// $Id$
/**
* Implementation of hook_schema().
*/
function user_schema() {
$schema['access'] = array(
2007-10-10 11:39:35 +00:00
'description' => t('Stores site access rules.'),
2007-10-05 16:07:22 +00:00
'fields' => array(
2007-10-10 11:39:35 +00:00
'aid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => t('Primary Key: Unique access ID.'),
),
'mask' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => t('Text mask used for filtering access.'),
),
'type' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => t('Type of access rule: name, mail or host.'),
),
'status' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => t('Whether rule is to allow(1) or deny(0) access.'),
),
2007-10-05 16:07:22 +00:00
),
'primary key' => array('aid'),
);
$schema['authmap'] = array(
2007-10-10 11:39:35 +00:00
'description' => t('Stores distributed authentication mapping.'),
2007-10-05 16:07:22 +00:00
'fields' => array(
2007-10-10 11:39:35 +00:00
'aid' => array(
'description' => t('Primary Key: Unique authmap ID.'),
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'uid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
2007-11-04 14:33:07 +00:00
'description' => t("User's {users}.uid."),
2007-10-10 11:39:35 +00:00
),
'authname' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => t('Unique authentication name.'),
),
'module' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => t('Module which is controlling the authentication.'),
),
2007-10-05 16:07:22 +00:00
),
'unique keys' => array('authname' => array('authname')),
'primary key' => array('aid'),
);
$schema['permission'] = array(
2007-10-10 11:39:35 +00:00
'description' => t('Stores permissions for users.'),
2007-10-05 16:07:22 +00:00
'fields' => array(
2007-10-10 11:39:35 +00:00
'pid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => t('Primary Key: Unique permission ID.'),
),
'rid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => t('The {role}.rid to which the permissions are assigned.'),
),
'perm' => array(
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
'description' => t('List of permissions being assigned.'),
),
'tid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => t('Originally intended for taxonomy-based permissions, but never used.'),
),
2007-10-05 16:07:22 +00:00
),
'primary key' => array('pid'),
'indexes' => array('rid' => array('rid')),
);
$schema['role'] = array(
2007-10-10 11:39:35 +00:00
'description' => t('Stores user roles.'),
2007-10-05 16:07:22 +00:00
'fields' => array(
2007-10-10 11:39:35 +00:00
'rid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => t('Primary Key: Unique role id.'),
),
'name' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
'description' => t('Unique role name.'),
),
2007-10-05 16:07:22 +00:00
),
'unique keys' => array('name' => array('name')),
'primary key' => array('rid'),
);
$schema['users'] = array(
2007-10-10 11:39:35 +00:00
'description' => t('Stores user data.'),
2007-10-05 16:07:22 +00:00
'fields' => array(
2007-10-10 11:39:35 +00:00
'uid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => t('Primary Key: Unique user ID.'),
),
'name' => array(
'type' => 'varchar',
'length' => 60,
'not null' => TRUE,
'default' => '',
'description' => t('Unique user name.'),
),
'pass' => array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
'description' => t("User's password (md5 hash)."),
),
'mail' => array(
'type' => 'varchar',
'length' => 64,
'not null' => FALSE,
'default' => '',
'description' => t("User's email address."),
),
'mode' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => t('Per-user comment display mode (threaded vs. flat), used by the {comment} module.'),
),
'sort' => array(
'type' => 'int',
'not null' => FALSE,
'default' => 0,
'size' => 'tiny',
'description' => t('Per-user comment sort order (newest vs. oldest first), used by the {comment} module.'),
),
'threshold' => array(
'type' => 'int',
'not null' => FALSE,
'default' => 0,
'size' => 'tiny',
'description' => t('Previously used by the {comment} module for per-user preferences; no longer used.'),
),
'theme' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => t("User's default theme."),
),
'signature' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => t("User's signature."),
),
'created' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => t('Timestamp for when user was created.'),
),
'access' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => t('Timestamp for previous time user accessed the site.'),
),
'login' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => t("Timestamp for user's last login."),
),
'status' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => t('Whether the user is active(1) or blocked(0).'),
),
'timezone' => array(
'type' => 'varchar',
'length' => 8,
'not null' => FALSE,
'description' => t("User's timezone."),
),
'language' => array(
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
'description' => t("User's default language."),
),
'picture' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => t("Path to the user's uploaded picture."),
),
'init' => array(
'type' => 'varchar',
'length' => 64,
'not null' => FALSE,
'default' => '',
'description' => t('Email address used for initial account creation.'),
),
'data' => array(
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
2008-02-18 16:53:37 +00:00
'serialize' => TRUE,
2007-10-10 11:39:35 +00:00
'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.'),
),
2007-10-05 16:07:22 +00:00
),
'indexes' => array(
2007-10-10 11:39:35 +00:00
'access' => array('access'),
2008-01-08 07:46:41 +00:00
'created' => array('created'),
'mail' => array('mail'),
2007-10-05 16:07:22 +00:00
),
2007-12-18 12:59:22 +00:00
'unique keys' => array(
'name' => array('name'),
),
2007-10-05 16:07:22 +00:00
'primary key' => array('uid'),
);
$schema['users_roles'] = array(
2007-10-10 11:39:35 +00:00
'description' => t('Maps users to roles.'),
2007-10-05 16:07:22 +00:00
'fields' => array(
2007-10-10 11:39:35 +00:00
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
2007-11-04 14:33:07 +00:00
'description' => t('Primary Key: {users}.uid for user.'),
2007-10-10 11:39:35 +00:00
),
'rid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => t('Primary Key: {role}.rid for role.'),
),
2007-10-05 16:07:22 +00:00
),
'primary key' => array('uid', 'rid'),
2007-12-18 12:59:22 +00:00
'indexes' => array(
'rid' => array('rid'),
),
2007-10-05 16:07:22 +00:00
);
return $schema;
}