function _field_sql_storage_revision_tablename

Generates a table name for a field revision archive table.

When a field is a deleted, the table is renamed to {field_deleted_revision_FIELD_UUID}. To make sure we don't end up with table names longer than 64 characters, we hash the uuid and return the first 10 characters so we end up with a short unique ID.

Parameters

$name: The field structure.

Return value

A string containing the generated name for the database table.

23 calls to _field_sql_storage_revision_tablename()
ApiDataTest::testViewsData in drupal/core/modules/field/lib/Drupal/field/Tests/Views/ApiDataTest.php
Unit testing the views data structure.
FieldSqlStorageTest::setUp in drupal/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Tests/FieldSqlStorageTest.php
Sets up Drupal unit test environment.
FieldSqlStorageTest::testFieldStorageDetails in drupal/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Tests/FieldSqlStorageTest.php
Test the storage details.
FieldSqlStorageTest::testFieldUpdateIndexesWithData in drupal/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Tests/FieldSqlStorageTest.php
Test adding and removing indexes while data is present.
field_sql_storage_entity_bundle_rename in drupal/core/modules/field_sql_storage/field_sql_storage.module
Implements hook_entity_bundle_rename().

... See full list

1 string reference to '_field_sql_storage_revision_tablename'
hook_field_storage_query in drupal/core/modules/field/field.api.php
Execute a Drupal\Core\Entity\EntityFieldQuery.

File

drupal/core/modules/field_sql_storage/field_sql_storage.module, line 75
Default implementation of the field storage API.

Code

function _field_sql_storage_revision_tablename($field) {
  if ($field['deleted']) {
    return "field_deleted_revision_" . substr(hash('sha256', $field['uuid']), 0, 10);
  }
  else {
    return "field_revision_{$field['field_name']}";
  }
}