/** * {@inheritdoc} */ protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) { $schema = parent::getEntitySchema($entity_type, $reset); $schema['users_field_data']['unique keys'] += array('user__name' => array('name', 'langcode')); $schema['users_roles'] = array('description' => 'Maps users to roles.', 'fields' => array('uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'Primary Key: {users}.uid for user.'), 'rid' => array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'description' => 'Primary Key: ID for the role.')), 'primary key' => array('uid', 'rid'), 'indexes' => array('rid' => array('rid')), 'foreign keys' => array('user' => array('table' => 'users', 'columns' => array('uid' => 'uid')))); return $schema; }
/** * {@inheritdoc} */ protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) { $schema = parent::getEntitySchema($entity_type, $reset = FALSE); $schema['taxonomy_term_field_data']['indexes'] += array('taxonomy_term__tree' => array('vid', 'weight', 'name'), 'taxonomy_term__vid_name' => array('vid', 'name')); $schema['taxonomy_term_hierarchy'] = array('description' => 'Stores the hierarchical relationship between terms.', 'fields' => array('tid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'Primary Key: The {taxonomy_term_data}.tid of the term.'), 'parent' => array('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' => array('parent' => array('parent')), 'foreign keys' => array('taxonomy_term_data' => array('table' => 'taxonomy_term_data', 'columns' => array('tid' => 'tid'))), 'primary key' => array('tid', 'parent')); $schema['taxonomy_index'] = array('description' => 'Maintains denormalized information about node/term relationships.', 'fields' => array('nid' => array('description' => 'The {node}.nid this record tracks.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), 'tid' => array('description' => 'The term ID.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), 'status' => array('description' => 'Boolean indicating whether the node is published (visible to non-administrators).', 'type' => 'int', 'not null' => TRUE, 'default' => 1), 'sticky' => array('description' => 'Boolean indicating whether the node is sticky.', 'type' => 'int', 'not null' => FALSE, 'default' => 0, 'size' => 'tiny'), 'created' => array('description' => 'The Unix timestamp when the node was created.', 'type' => 'int', 'not null' => TRUE, 'default' => 0)), 'primary key' => array('nid', 'tid'), 'indexes' => array('term_node' => array('tid', 'status', 'sticky', 'created')), 'foreign keys' => array('tracked_node' => array('table' => 'node', 'columns' => array('nid' => 'nid')), 'term' => array('table' => 'taxonomy_term_data', 'columns' => array('tid' => 'tid')))); return $schema; }
/** * {@inheritdoc} */ protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) { $schema = parent::getEntitySchema($entity_type, $reset); // Add indexes. $schema['redirect']['unique keys'] += ['hash' => ['hash']]; $schema['redirect']['indexes'] += ['source_language' => [['redirect_source__path', 191], 'language']]; return $schema; }
/** * {@inheritdoc} */ protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) { $schema = parent::getEntitySchema($entity_type, $reset); if ($entity_type->id() == 'entity_test_update') { $schema[$entity_type->getBaseTable()]['indexes'] += \Drupal::state()->get('entity_test_update.additional_entity_indexes', array()); } return $schema; }
/** * {@inheritdoc} */ protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) { $schema = parent::getEntitySchema($entity_type, $reset); // Creates an index to ensure that the lookup in // \Drupal\content_moderation\Plugin\Field\ModerationStateFieldItemList::getModerationState() // is performant. $schema['content_moderation_state_field_data']['indexes'] += array('content_moderation_state__lookup' => array('content_entity_type_id', 'content_entity_id', 'content_entity_revision_id')); return $schema; }
/** * {@inheritdoc} */ protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) { $schema = parent::getEntitySchema($entity_type, $reset); // Marking the respective fields as NOT NULL makes the indexes more // performant. $schema['node_field_data']['fields']['default_langcode']['not null'] = TRUE; $schema['node_field_revision']['fields']['default_langcode']['not null'] = TRUE; $schema['node_field_data']['indexes'] += array('node__default_langcode' => array('default_langcode'), 'node__frontpage' => array('promote', 'status', 'sticky', 'created'), 'node__status_type' => array('status', 'type', 'nid'), 'node__title_type' => array('title', array('type', 4))); $schema['node_field_revision']['indexes'] += array('node__default_langcode' => array('default_langcode')); return $schema; }
/** * {@inheritdoc} */ protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) { $schema = parent::getEntitySchema($entity_type, $reset); // @todo Create a numeric field type and use that instead. $schema['uc_orders']['fields']['order_total']['type'] = 'numeric'; $schema['uc_orders']['fields']['order_total']['precision'] = 16; $schema['uc_orders']['fields']['order_total']['scale'] = 5; // Marking the respective fields as NOT NULL makes the indexes more // performant. $schema['uc_orders']['fields']['uid']['not null'] = TRUE; $schema['uc_orders']['fields']['order_status']['not null'] = TRUE; $schema['uc_orders']['indexes'] += array('uid' => array('uid'), 'order_status' => array('order_status')); $schema['uc_orders']['foreign keys'] += array('users' => array('table' => 'users', 'columns' => array('uid' => 'uid'))); return $schema; }
/** * {@inheritdoc} */ protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) { $schema = parent::getEntitySchema($entity_type, $reset); $schema['users_field_data']['unique keys'] += array('user__name' => array('name', 'langcode')); return $schema; }
/** * {@inheritdoc} */ protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) { $schema = parent::getEntitySchema($entity_type, $reset); $schema['comment_field_data']['indexes'] += array('comment__status_pid' => array('pid', 'status'), 'comment__num_new' => array('entity_id', 'entity_type', 'comment_type', 'status', 'created', 'cid', 'thread'), 'comment__entity_langcode' => array('entity_id', 'entity_type', 'comment_type', 'default_langcode')); return $schema; }
/** * {@inheritdoc} */ protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) { $schema = parent::getEntitySchema($entity_type, $reset); $schema['node_field_data']['indexes'] += array('node__frontpage' => array('promote', 'status', 'sticky', 'created'), 'node__status_type' => array('status', 'type', 'nid'), 'node__title_type' => array('title', array('type', 4))); return $schema; }
/** * {@inheritdoc} */ protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) { $schema = parent::getEntitySchema($entity_type, $reset); $schema['support_ticket_field_data']['indexes'] += array('support_ticket__status_type' => array('status', 'support_ticket_type', 'stid'), 'support_ticket__title_type' => array('title', array('support_ticket_type', 4))); return $schema; }
/** * {@inheritdoc} */ protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) { $schema = parent::getEntitySchema($entity_type, $reset); $schema['paragraphs_item_field_data']['indexes'] += array('paragraphs__parent_fields' => array('parent_type', 'parent_id', 'parent_field_name')); return $schema; }
/** * {@inheritdoc} */ protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) { $schema = parent::getEntitySchema($entity_type, $reset); $schema['block_content_field_data']['unique keys'] += array('block_content__info' => array('info', 'langcode')); return $schema; }
/** * {@inheritdoc} */ protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) { $schema = parent::getEntitySchema($entity_type, $reset); $this->alterEntitySchemaWithNonFieldColumns($schema); return $schema; }