comparison core/modules/taxonomy/src/TermStorageSchema.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 129ea1e6d783
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
106 } 106 }
107 107
108 return $schema; 108 return $schema;
109 } 109 }
110 110
111 /**
112 * {@inheritdoc}
113 */
114 protected function getDedicatedTableSchema(FieldStorageDefinitionInterface $storage_definition, ContentEntityTypeInterface $entity_type = NULL) {
115 $dedicated_table_schema = parent::getDedicatedTableSchema($storage_definition, $entity_type);
116
117 // Add an index on 'bundle', 'delta' and 'parent_target_id' columns to
118 // increase the performance of the query from
119 // \Drupal\taxonomy\TermStorage::getVocabularyHierarchyType().
120 if ($storage_definition->getName() === 'parent') {
121 /** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
122 $table_mapping = $this->storage->getTableMapping();
123 $dedicated_table_name = $table_mapping->getDedicatedDataTableName($storage_definition);
124
125 unset($dedicated_table_schema[$dedicated_table_name]['indexes']['bundle']);
126 $dedicated_table_schema[$dedicated_table_name]['indexes']['bundle_delta_target_id'] = [
127 'bundle',
128 'delta',
129 $table_mapping->getFieldColumnName($storage_definition, 'target_id'),
130 ];
131 }
132
133 return $dedicated_table_schema;
134 }
135
111 } 136 }