function system_schema in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/system.install \system_schema()
- 6 modules/system/system.install \system_schema()
- 7 modules/system/system.install \system_schema()
- 10 core/modules/system/system.install \system_schema()
Implements hook_schema().
2 calls to system_schema()
- install_begin_request in core/
includes/ install.core.inc - Begins an installation request, modifying the installation state as needed.
- install_verify_database_ready in core/
includes/ install.core.inc - Verify that the database is ready (no existing Drupal installation).
File
- core/
modules/ system/ system.install, line 1344 - Install, update and uninstall functions for the system module.
Code
function system_schema() {
$schema['sequences'] = [
'description' => 'Stores IDs.',
'fields' => [
'value' => [
'description' => 'The value of the sequence.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
],
],
'primary key' => [
'value',
],
];
$schema['sessions'] = [
'description' => "Drupal's session handlers read and write into the sessions table. Each record represents a user session, either anonymous or authenticated.",
'fields' => [
'uid' => [
'description' => 'The {users}.uid corresponding to a session, or 0 for anonymous user.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
],
'sid' => [
'description' => "A session ID (hashed). The value is generated by Drupal's session handlers.",
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
],
'hostname' => [
'description' => 'The IP address that last used this session ID (sid).',
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
'default' => '',
],
'timestamp' => [
'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,
],
'session' => [
'description' => 'The serialized contents of the user\'s session, an array of name/value pairs that persists across page requests by this session ID. Drupal loads the user\'s session from here at the start of each request and saves it at the end.',
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
],
],
'primary key' => [
'sid',
],
'indexes' => [
'timestamp' => [
'timestamp',
],
'uid' => [
'uid',
],
],
'foreign keys' => [
'session_user' => [
'table' => 'users',
'columns' => [
'uid' => 'uid',
],
],
],
];
return $schema;
}