LogStorageSchema.php in Log entity 8
Contains \Drupal\log\LogStorageSchema.
Namespace
Drupal\logFile
src/LogStorageSchema.phpView source
<?php
/**
* @file
* Contains \Drupal\log\LogStorageSchema.
*/
namespace Drupal\log;
use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
/**
* Defines the log schema handler.
*/
class LogStorageSchema extends SqlContentEntityStorageSchema {
/**
* {@inheritdoc}
*/
protected function getSharedTableFieldSchema(FieldStorageDefinitionInterface $storage_definition, $table_name, array $column_mapping) {
$schema = parent::getSharedTableFieldSchema($storage_definition, $table_name, $column_mapping);
$field_name = $storage_definition
->getName();
if ($table_name == 'log_revision') {
switch ($field_name) {
case 'langcode':
$this
->addSharedTableFieldIndex($storage_definition, $schema, TRUE);
break;
case 'revision_uid':
$this
->addSharedTableFieldForeignKey($storage_definition, $schema, 'users', 'uid');
break;
}
}
if ($table_name == 'log_field_data') {
switch ($field_name) {
case 'name':
// Improves the performance of the indexes defined
// in getEntitySchema().
$schema['fields'][$field_name]['not null'] = TRUE;
break;
case 'changed':
case 'created':
// @todo Revisit index definitions:
// https://www.drupal.org/node/2015277.
$this
->addSharedTableFieldIndex($storage_definition, $schema, TRUE);
break;
}
}
return $schema;
}
}
Classes
Name![]() |
Description |
---|---|
LogStorageSchema | Defines the log schema handler. |