function DatabaseStorage::schemaDefinition

Same name in this branch
  1. 9 core/lib/Drupal/Core/Config/DatabaseStorage.php \Drupal\Core\Config\DatabaseStorage::schemaDefinition()
Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Config/DatabaseStorage.php \Drupal\Core\Config\DatabaseStorage::schemaDefinition()
  2. 10 core/lib/Drupal/Core/Config/DatabaseStorage.php \Drupal\Core\Config\DatabaseStorage::schemaDefinition()
  3. 10 core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php \Drupal\Core\KeyValueStore\DatabaseStorage::schemaDefinition()
  4. 11.x core/lib/Drupal/Core/Config/DatabaseStorage.php \Drupal\Core\Config\DatabaseStorage::schemaDefinition()
  5. 11.x core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php \Drupal\Core\KeyValueStore\DatabaseStorage::schemaDefinition()

Defines the schema for the key_value table.

1 call to DatabaseStorage::schemaDefinition()
DatabaseStorage::ensureTableExists in core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php
Check if the table exists and create it if not.
1 method overrides DatabaseStorage::schemaDefinition()
DatabaseStorageExpirable::schemaDefinition in core/lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php
Defines the schema for the key_value_expire table.

File

core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php, line 293

Class

DatabaseStorage
Defines a default key/value store implementation.

Namespace

Drupal\Core\KeyValueStore

Code

public static function schemaDefinition() {
    return [
        'description' => 'Generic key-value storage table. See the state system for an example.',
        'fields' => [
            'collection' => [
                'description' => 'A named collection of key and value pairs.',
                'type' => 'varchar_ascii',
                'length' => 128,
                'not null' => TRUE,
                'default' => '',
            ],
            'name' => [
                'description' => 'The key of the key-value pair. As KEY is a SQL reserved keyword, name was chosen instead.',
                'type' => 'varchar_ascii',
                'length' => 128,
                'not null' => TRUE,
                'default' => '',
            ],
            'value' => [
                'description' => 'The value.',
                'type' => 'blob',
                'not null' => TRUE,
                'size' => 'big',
            ],
        ],
        'primary key' => [
            'collection',
            'name',
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.