You are here

protected function SqlContentEntityStorageSchema::deleteDedicatedTableSchema in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::deleteDedicatedTableSchema()
  2. 9 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::deleteDedicatedTableSchema()

Deletes the schema for a field stored in a dedicated table.

Parameters

\Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition: The storage definition of the field being deleted.

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php, line 1649

Class

SqlContentEntityStorageSchema
Defines a schema handler that supports revisionable, translatable entities.

Namespace

Drupal\Core\Entity\Sql

Code

protected function deleteDedicatedTableSchema(FieldStorageDefinitionInterface $storage_definition) {
  $table_mapping = $this
    ->getTableMapping($this->entityType, [
    $storage_definition,
  ]);
  $table_name = $table_mapping
    ->getDedicatedDataTableName($storage_definition, $storage_definition
    ->isDeleted());
  if ($this->database
    ->schema()
    ->tableExists($table_name)) {
    $this->database
      ->schema()
      ->dropTable($table_name);
  }
  if ($this->entityType
    ->isRevisionable()) {
    $revision_table_name = $table_mapping
      ->getDedicatedRevisionTableName($storage_definition, $storage_definition
      ->isDeleted());
    if ($this->database
      ->schema()
      ->tableExists($revision_table_name)) {
      $this->database
        ->schema()
        ->dropTable($revision_table_name);
    }
  }
  $this
    ->deleteFieldSchemaData($storage_definition);
}