diff core/modules/taxonomy/src/TermStorageSchema.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children af1871eacc83
line wrap: on
line diff
--- a/core/modules/taxonomy/src/TermStorageSchema.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/core/modules/taxonomy/src/TermStorageSchema.php	Thu Feb 28 13:21:36 2019 +0000
@@ -15,42 +15,14 @@
    * {@inheritdoc}
    */
   protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) {
-    $schema = parent::getEntitySchema($entity_type, $reset = FALSE);
+    $schema = parent::getEntitySchema($entity_type, $reset);
 
-    $schema['taxonomy_term_field_data']['indexes'] += [
-      'taxonomy_term__tree' => ['vid', 'weight', 'name'],
-      'taxonomy_term__vid_name' => ['vid', 'name'],
-    ];
-
-    $schema['taxonomy_term_hierarchy'] = [
-      'description' => 'Stores the hierarchical relationship between terms.',
-      'fields' => [
-        'tid' => [
-          'type' => 'int',
-          'unsigned' => TRUE,
-          'not null' => TRUE,
-          'default' => 0,
-          'description' => 'Primary Key: The {taxonomy_term_data}.tid of the term.',
-        ],
-        'parent' => [
-          'type' => 'int',
-          'unsigned' => TRUE,
-          'not null' => TRUE,
-          'default' => 0,
-          'description' => "Primary Key: The {taxonomy_term_data}.tid of the term's parent. 0 indicates no parent.",
-        ],
-      ],
-      'indexes' => [
-        'parent' => ['parent'],
-      ],
-      'foreign keys' => [
-        'taxonomy_term_data' => [
-          'table' => 'taxonomy_term_data',
-          'columns' => ['tid' => 'tid'],
-        ],
-      ],
-      'primary key' => ['tid', 'parent'],
-    ];
+    if ($data_table = $this->storage->getDataTable()) {
+      $schema[$data_table]['indexes'] += [
+        'taxonomy_term__tree' => ['vid', 'weight', 'name'],
+        'taxonomy_term__vid_name' => ['vid', 'name'],
+      ];
+    }
 
     $schema['taxonomy_index'] = [
       'description' => 'Maintains denormalized information about node/term relationships.',