/** * {@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 == 'users_field_data') { switch ($field_name) { case 'name': // Improves the performance of the user__name index defined // in getEntitySchema(). $schema['fields'][$field_name]['not null'] = TRUE; // Make sure the field is no longer than 191 characters so we can // add a unique constraint in MySQL. $schema['fields'][$field_name]['length'] = USERNAME_MAX_LENGTH; break; case 'mail': $this->addSharedTableFieldIndex($storage_definition, $schema); break; case 'access': case 'created': $this->addSharedTableFieldIndex($storage_definition, $schema, TRUE); break; } } return $schema; }
/** * {@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 == 'node_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 == 'node_field_data') { switch ($field_name) { case 'promote': case 'status': case 'sticky': case 'title': // 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; }
/** * {@inheritdoc} */ protected function getSharedTableFieldSchema(FieldStorageDefinitionInterface $storage_definition, $table_name, array $column_mapping) { $schema = parent::getSharedTableFieldSchema($storage_definition, $table_name, $column_mapping); if (\Drupal::state()->get('entity_test_update.additional_field_index.' . $table_name . '.' . $storage_definition->getName())) { $this->addSharedTableFieldIndex($storage_definition, $schema); } return $schema; }
/** * {@inheritdoc} */ protected function getSharedTableFieldSchema(FieldStorageDefinitionInterface $storage_definition, $table_name, array $column_mapping) { // Setting the initial value to 1 when we add a 'status' field. // @todo this is a workaround for https://www.drupal.org/node/2346019 $schema = parent::getSharedTableFieldSchema($storage_definition, $table_name, $column_mapping); if ($storage_definition->getName() == 'status') { $schema['fields']['status']['initial'] = 1; } return $schema; }
/** * {@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 == 'menu_link_content') { switch ($field_name) { case 'rediscover': $this->addSharedTableFieldIndex($storage_definition, $schema, TRUE); break; } } return $schema; }
/** * {@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 == 'block_content_field_data') { switch ($field_name) { case 'info': // Improves the performance of the block_content__info index defined // in getEntitySchema(). $schema['fields'][$field_name]['not null'] = TRUE; break; } } return $schema; }
/** * {@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 == 'aggregator_item') { switch ($field_name) { case 'timestamp': $this->addSharedTableFieldIndex($storage_definition, $schema, TRUE); break; case 'fid': $this->addSharedTableFieldForeignKey($storage_definition, $schema, 'aggregator_feed', 'fid'); break; } } return $schema; }
/** * {@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 == 'file_managed') { switch ($field_name) { case 'status': case 'changed': $this->addSharedTableFieldIndex($storage_definition, $schema, TRUE); break; case 'uri': $this->addSharedTableFieldUniqueKey($storage_definition, $schema, TRUE); break; } } return $schema; }
/** * {@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 == 'aggregator_feed') { switch ($field_name) { case 'url': $this->addSharedTableFieldIndex($storage_definition, $schema, TRUE, 255); break; case 'queued': $this->addSharedTableFieldIndex($storage_definition, $schema, TRUE); break; case 'title': $this->addSharedTableFieldIndex($storage_definition, $schema, TRUE); break; } } return $schema; }
/** * {@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 == 'file_managed') { switch ($field_name) { case 'status': case 'changed': $this->addSharedTableFieldIndex($storage_definition, $schema, TRUE); break; case 'uri': $this->addSharedTableFieldUniqueKey($storage_definition, $schema, TRUE); // @todo There should be a 'binary' field type or setting: // https://www.drupal.org/node/2068655. $schema['fields'][$field_name]['binary'] = TRUE; break; } } return $schema; }
/** * {@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 == 'taxonomy_term_field_data') { // Remove unneeded indexes. unset($schema['indexes']['taxonomy_term_field__vid__target_id']); unset($schema['indexes']['taxonomy_term_field__description__format']); switch ($field_name) { case 'weight': // Improves the performance of the taxonomy_term__tree index defined // in getEntitySchema(). $schema['fields'][$field_name]['not null'] = TRUE; break; case 'name': $this->addSharedTableFieldIndex($storage_definition, $schema, TRUE); break; } } return $schema; }
/** * {@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 == 'users_field_data') { switch ($field_name) { case 'name': // Improves the performance of the user__name index defined // in getEntitySchema(). $schema['fields'][$field_name]['not null'] = TRUE; break; case 'mail': $this->addSharedTableFieldIndex($storage_definition, $schema); break; case 'access': case 'created': $this->addSharedTableFieldIndex($storage_definition, $schema, TRUE); break; } } return $schema; }
/** * {@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 == 'comment_field_data') { // Remove unneeded indexes. unset($schema['indexes']['comment_field__pid__target_id']); unset($schema['indexes']['comment_field__entity_id__target_id']); switch ($field_name) { case 'thread': // Improves the performance of the comment__num_new index defined // in getEntitySchema(). $schema['fields'][$field_name]['not null'] = TRUE; break; case 'created': $this->addSharedTableFieldIndex($storage_definition, $schema, TRUE); break; case 'uid': $this->addSharedTableFieldForeignKey($storage_definition, $schema, 'users', 'uid'); } } return $schema; }