Commit a275a9e3 authored by Berdir's avatar Berdir Committed by Berdir

Issue #2947259 by Berdir: Library status field upgrade path can fail if there...

Issue #2947259 by Berdir: Library status field upgrade path can fail if there are NULL values in content_translation_status
parent 5f654a87
......@@ -278,7 +278,18 @@ function paragraphs_library_update_8006() {
->setDisplayConfigurable('form', TRUE);
$has_content_translation_status_field = \Drupal::moduleHandler()->moduleExists('content_translation') && $definition_update_manager->getFieldStorageDefinition('content_translation_status', $entity_type->id());
$database = \Drupal::database();
if ($has_content_translation_status_field) {
// Make sure that there are no NULL values.
$database->update($entity_type->getDataTable())
->fields(['content_translation_status' => 1])
->isNull('content_translation_status')
->execute();
$database->update($entity_type->getRevisionDataTable())
->fields(['content_translation_status' => 1])
->isNull('content_translation_status')
->execute();
$status->setInitialValueFromField('content_translation_status');
}
else {
......@@ -288,7 +299,6 @@ function paragraphs_library_update_8006() {
// Uninstall the 'content_translation_status' field if needed.
if ($has_content_translation_status_field) {
$database = \Drupal::database();
$database->update($entity_type->getDataTable())
->fields(['content_translation_status' => NULL])
->execute();
......
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