You are here

public static function DatabaseStorage::schemaDefinition in Drupal 9

Same name in this branch
  1. 9 core/lib/Drupal/Core/Config/DatabaseStorage.php \Drupal\Core\Config\DatabaseStorage::schemaDefinition()
  2. 9 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 291

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',
    ],
  ];
}