function DatabaseLockBackend::schemaDefinition

Same name in this branch
  1. 9 core/lib/Drupal/Core/ProxyClass/Lock/DatabaseLockBackend.php \Drupal\Core\ProxyClass\Lock\DatabaseLockBackend::schemaDefinition()
Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/ProxyClass/Lock/DatabaseLockBackend.php \Drupal\Core\ProxyClass\Lock\DatabaseLockBackend::schemaDefinition()
  2. 8.9.x core/lib/Drupal/Core/Lock/DatabaseLockBackend.php \Drupal\Core\Lock\DatabaseLockBackend::schemaDefinition()
  3. 10 core/lib/Drupal/Core/ProxyClass/Lock/DatabaseLockBackend.php \Drupal\Core\ProxyClass\Lock\DatabaseLockBackend::schemaDefinition()
  4. 10 core/lib/Drupal/Core/Lock/DatabaseLockBackend.php \Drupal\Core\Lock\DatabaseLockBackend::schemaDefinition()
  5. 11.x core/lib/Drupal/Core/ProxyClass/Lock/DatabaseLockBackend.php \Drupal\Core\ProxyClass\Lock\DatabaseLockBackend::schemaDefinition()
  6. 11.x core/lib/Drupal/Core/Lock/DatabaseLockBackend.php \Drupal\Core\Lock\DatabaseLockBackend::schemaDefinition()

Defines the schema for the semaphore table.

@internal

1 call to DatabaseLockBackend::schemaDefinition()
DatabaseLockBackend::ensureTableExists in core/lib/Drupal/Core/Lock/DatabaseLockBackend.php
Check if the semaphore table exists and create it if not.

File

core/lib/Drupal/Core/Lock/DatabaseLockBackend.php, line 244

Class

DatabaseLockBackend
Defines the database lock backend. This is the default backend in Drupal.

Namespace

Drupal\Core\Lock

Code

public function schemaDefinition() {
    return [
        'description' => 'Table for holding semaphores, locks, flags, etc. that cannot be stored as state since they must not be cached.',
        'fields' => [
            'name' => [
                'description' => 'Primary Key: Unique name.',
                'type' => 'varchar_ascii',
                'length' => 255,
                'not null' => TRUE,
                'default' => '',
            ],
            'value' => [
                'description' => 'A value for the semaphore.',
                'type' => 'varchar_ascii',
                'length' => 255,
                'not null' => TRUE,
                'default' => '',
            ],
            'expire' => [
                'description' => 'A Unix timestamp with microseconds indicating when the semaphore should expire.',
                'type' => 'float',
                'size' => 'big',
                'not null' => TRUE,
            ],
        ],
        'indexes' => [
            'value' => [
                'value',
            ],
            'expire' => [
                'expire',
            ],
        ],
        'primary key' => [
            'name',
        ],
    ];
}

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