You are here

function user_revision_schema in User Revision 7.2

Same name and namespace in other branches
  1. 7 user_revision.install \user_revision_schema()

Implements hook_schema().

1 call to user_revision_schema()
user_revision_entity_info_alter in ./user_revision.module
Implements hook_entity_info_alter().

File

./user_revision.install, line 11
Install, update and uninstall functions for the user_revision module.

Code

function user_revision_schema() {
  $schema['user_revision'] = array(
    'description' => 'Stores user_revision data.',
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary Key: Unique user ID.',
        'default' => 0,
      ),
      'vid' => array(
        'description' => 'The primary identifier for this version.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'log' => array(
        'description' => 'The log entry explaining the changes in this version.',
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
      ),
      'timestamp' => array(
        'description' => 'A Unix timestamp indicating when this version was created.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'authorid' => array(
        'description' => 'The {users}.uid that created this version.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 60,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Unique user name.',
      ),
      'mail' => array(
        'type' => 'varchar',
        'length' => 254,
        'not null' => FALSE,
        'default' => '',
        'description' => "User's e-mail address.",
      ),
      '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' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
        'description' => 'The {filter_format}.format of the signature.',
      ),
      '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' => 32,
        'not null' => FALSE,
        'description' => "User's time zone.",
      ),
      'language' => array(
        'type' => 'varchar',
        'length' => 12,
        'not null' => TRUE,
        'default' => '',
        'description' => "User's default language.",
      ),
      'picture' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => "Foreign key: {file_managed}.fid of user's picture.",
      ),
      'data' => array(
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
        'serialize' => TRUE,
        '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.',
      ),
      'ip' => array(
        'type' => 'varchar',
        'description' => 'The users\'s ip address.',
        'length' => 256,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'indexes' => array(
      'uid' => array(
        'uid',
      ),
    ),
    'primary key' => array(
      'vid',
    ),
    'foreign keys' => array(
      'versioned_user' => array(
        'table' => 'users',
        'columns' => array(
          'uid' => 'uid',
        ),
      ),
      'version_author' => array(
        'table' => 'users',
        'columns' => array(
          'authorid' => 'uid',
        ),
      ),
      'signature_format' => array(
        'table' => 'filter_format',
        'columns' => array(
          'signature_format' => 'format',
        ),
      ),
    ),
  );
  $schema['user_revision_roles'] = array(
    'description' => 'Stores user_revision roles data.',
    'fields' => array(
      'uid' => array(
        'description' => 'Primary Key: Unique user ID.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'vid' => array(
        'description' => 'Primary Key: Unique version ID.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'rid' => array(
        'description' => 'Primary Key: Role ID.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
    ),
    'indexes' => array(
      'uid' => array(
        'uid',
      ),
    ),
    'primary key' => array(
      'uid',
      'vid',
      'rid',
    ),
    'foreign keys' => array(
      'versioned_user' => array(
        'table' => 'users',
        'columns' => array(
          'uid' => 'uid',
        ),
      ),
      'version_id' => array(
        'table' => 'user_revision',
        'columns' => array(
          'vid' => 'vid',
        ),
      ),
      'role_id' => array(
        'table' => 'role',
        'columns' => array(
          'rid' => 'rid',
        ),
      ),
    ),
  );
  return $schema;
}