function DatabaseBackend::schemaDefinition

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

Defines the schema for the flood table.

@internal

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

File

core/lib/Drupal/Core/Flood/DatabaseBackend.php, line 198

Class

DatabaseBackend
Defines the database flood backend. This is the default Drupal backend.

Namespace

Drupal\Core\Flood

Code

public function schemaDefinition() {
    return [
        'description' => 'Flood controls the threshold of events, such as the number of contact attempts.',
        'fields' => [
            'fid' => [
                'description' => 'Unique flood event ID.',
                'type' => 'serial',
                'not null' => TRUE,
            ],
            'event' => [
                'description' => 'Name of event (e.g. contact).',
                'type' => 'varchar_ascii',
                'length' => 64,
                'not null' => TRUE,
                'default' => '',
            ],
            'identifier' => [
                'description' => 'Identifier of the visitor, such as an IP address or hostname.',
                'type' => 'varchar_ascii',
                'length' => 128,
                'not null' => TRUE,
                'default' => '',
            ],
            'timestamp' => [
                'description' => 'Timestamp of the event.',
                'type' => 'int',
                'not null' => TRUE,
                'default' => 0,
                'size' => 'big',
            ],
            'expiration' => [
                'description' => 'Expiration timestamp. Expired events are purged on cron run.',
                'type' => 'int',
                'not null' => TRUE,
                'default' => 0,
                'size' => 'big',
            ],
        ],
        'primary key' => [
            'fid',
        ],
        'indexes' => [
            'allow' => [
                'event',
                'identifier',
                'timestamp',
            ],
            'purge' => [
                'expiration',
            ],
        ],
    ];
}

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