public function testCreateFieldAndIndexOnSharedTable() { $this->
addBaseField();
$this->
addBaseFieldIndex();
$this->
applyEntityUpdates();
$this->
assertTrue($this->database->
schema()->
fieldExists('entity_test_update', 'new_base_field'
), "New field 'new_base_field' has been created on the 'entity_test_update' table."
);
$this->
assertTrue($this->database->
schema()->
indexExists('entity_test_update', 'entity_test_update_field__new_base_field'
), "New index 'entity_test_update_field__new_base_field' has been created on the 'entity_test_update' table."
);
// Check index size in for MySQL.
if (Database::
getConnection()->
driver() == 'mysql'
) { $result = Database::
getConnection()->
query('SHOW INDEX FROM {entity_test_update} WHERE key_name = \'entity_test_update_field__new_base_field\' and column_name = \'new_base_field\''
)->
fetchObject();
$this->
assertEquals(191,
$result->Sub_part, 'The index length has been restricted to 191 characters for UTF8MB4 compatibility.'
);
} } /**
* Ensures that a new entity level index is created when data exists.
*
* @see Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::onEntityTypeUpdate
*/
public function testCreateIndexUsingEntityStorageSchemaWithData() {