Drupal 7 中会话表的描述在其system_schema()
函数中给出:
$schema['sessions'] = array(
'description' => "Drupal's session handlers read and write into the sessions table. Each record represents a user session, either anonymous or authenticated.",
'fields' => array(
'uid' => array(
'description' => 'The {users}.uid corresponding to a session, or 0 for anonymous user.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'sid' => array(
'description' => "A session ID. The value is generated by Drupal's session handlers.",
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
'ssid' => array(
'description' => "Secure session ID. The value is generated by Drupal's session handlers.",
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'hostname' => array(
'description' => 'The IP address that last used this session ID (sid).',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'timestamp' => array(
'description' => 'The Unix timestamp when this session last requested a page. Old records are purged by PHP automatically.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'cache' => array(
'description' => "The time of this user's last post. This is used when the site has specified a minimum_cache_lifetime. See cache_get().",
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'session' => array(
'description' => 'The serialized contents of $_SESSION, an array of name/value pairs that persists across page requests by this session ID. Drupal loads $_SESSION from here at the start of each request and saves it at the end.',
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
),
),
'primary key' => array(
'sid',
'ssid',
),
'indexes' => array(
'timestamp' => array('timestamp'),
'uid' => array('uid'),
'ssid' => array('ssid'),
),
'foreign keys' => array(
'session_user' => array(
'table' => 'users',
'columns' => array('uid' => 'uid'),
),
),
);
但这不是 ER 模型。此外,它在很大程度上依赖于 Drupal 自己的会话处理功能。