View source
<?php
function user_schema() {
$schema['access'] = array(
'description' => 'Stores site access rules.',
'fields' => array(
'aid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique access ID.',
),
'mask' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Text mask used for filtering access.',
),
'type' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Type of access rule: name, mail or host.',
),
'status' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => 'Whether rule is to allow(1) or deny(0) access.',
),
),
'primary key' => array(
'aid',
),
);
$schema['authmap'] = array(
'description' => 'Stores distributed authentication mapping.',
'fields' => array(
'aid' => array(
'description' => 'Primary Key: Unique authmap ID.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'uid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => "User's {users}.uid.",
),
'authname' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'Unique authentication name.',
),
'module' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'Module which is controlling the authentication.',
),
),
'unique keys' => array(
'authname' => array(
'authname',
),
),
'primary key' => array(
'aid',
),
);
$schema['permission'] = array(
'description' => 'Stores permissions for users.',
'fields' => array(
'pid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique permission ID.',
),
'rid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The {role}.rid to which the permissions are assigned.',
),
'perm' => array(
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
'description' => 'List of permissions being assigned.',
),
'tid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Originally intended for taxonomy-based permissions, but never used.',
),
),
'primary key' => array(
'pid',
),
'indexes' => array(
'rid' => array(
'rid',
),
),
);
$schema['role'] = array(
'description' => 'Stores user roles.',
'fields' => array(
'rid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'Primary Key: Unique role id.',
),
'name' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
'description' => 'Unique role name.',
),
),
'unique keys' => array(
'name' => array(
'name',
),
),
'primary key' => array(
'rid',
),
);
$schema['users'] = array(
'description' => 'Stores user data.',
'fields' => array(
'uid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'Primary Key: Unique user ID.',
),
'name' => array(
'type' => 'varchar',
'length' => 60,
'not null' => TRUE,
'default' => '',
'description' => 'Unique user name.',
),
'pass' => array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
'description' => "User's password (md5 hash).",
),
'mail' => array(
'type' => 'varchar',
'length' => 64,
'not null' => FALSE,
'default' => '',
'description' => "User's email address.",
),
'mode' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => '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' => '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' => 'Previously used by the {comment} module for per-user preferences; no longer used.',
),
'theme' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => "User's default theme.",
),
'signature' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => "User's signature.",
),
'signature_format' => array(
'type' => 'int',
'size' => 'small',
'not null' => TRUE,
'default' => 0,
'description' => 'The {filter_formats}.format of the signature.',
),
'created' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Timestamp for when user was created.',
),
'access' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Timestamp for previous time user accessed the site.',
),
'login' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => "Timestamp for user's last login.",
),
'status' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => 'Whether the user is active(1) or blocked(0).',
),
'timezone' => array(
'type' => 'varchar',
'length' => 8,
'not null' => FALSE,
'description' => "User's timezone.",
),
'language' => array(
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
'description' => "User's default language.",
),
'picture' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => "Path to the user's uploaded picture.",
),
'init' => array(
'type' => 'varchar',
'length' => 64,
'not null' => FALSE,
'default' => '',
'description' => 'Email address used for initial account creation.',
),
'data' => array(
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
'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.',
),
),
'indexes' => array(
'access' => array(
'access',
),
'created' => array(
'created',
),
'mail' => array(
'mail',
),
),
'unique keys' => array(
'name' => array(
'name',
),
),
'primary key' => array(
'uid',
),
);
$schema['users_roles'] = array(
'description' => 'Maps users to roles.',
'fields' => array(
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Primary Key: {users}.uid for user.',
),
'rid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Primary Key: {role}.rid for role.',
),
),
'primary key' => array(
'uid',
'rid',
),
'indexes' => array(
'rid' => array(
'rid',
),
),
);
return $schema;
}