Unverified Commit 622d5c47 authored by larowlan's avatar larowlan

Issue #2923572 by Sam152: Account for NULL base field values in shared table...

Issue #2923572 by Sam152: Account for NULL base field values in shared table storage when copying to dedicated table storage for field purging
parent 88a22dda
......@@ -617,9 +617,12 @@ protected function getSelectQueryForFieldStorageDeletion($table_name, array $sha
$select->addExpression(':delta', 'delta', [':delta' => 0]);
// Add all the dynamic field columns.
$or = $select->orConditionGroup();
foreach ($shared_table_field_columns as $field_column_name => $schema_column_name) {
$select->addField('entity_table', $schema_column_name, $dedicated_table_field_columns[$field_column_name]);
$or->isNotNull($schema_column_name);
}
$select->condition($or);
// Lock the table rows.
$select->forUpdate(TRUE);
......
......@@ -395,6 +395,11 @@ public function testBaseFieldDeleteWithExistingData() {
$storage = $this->entityManager->getStorage('entity_test_update');
$schema_handler = $this->database->schema();
// Create an entity without the base field, to ensure NULL values are not
// added to the dedicated table storage to be purged.
$entity = $storage->create();
$entity->save();
// Add the base field and run the update.
$this->addBaseField();
$this->entityDefinitionUpdateManager->applyUpdates();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment