diff core/modules/comment/src/CommentStorageSchema.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 129ea1e6d783
children
line wrap: on
line diff
--- a/core/modules/comment/src/CommentStorageSchema.php	Thu Feb 28 13:21:36 2019 +0000
+++ b/core/modules/comment/src/CommentStorageSchema.php	Thu May 09 15:33:08 2019 +0100
@@ -5,6 +5,7 @@
 use Drupal\Core\Entity\ContentEntityTypeInterface;
 use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
+use Drupal\Core\Field\RequiredFieldStorageDefinitionInterface;
 
 /**
  * Defines the comment schema handler.
@@ -60,6 +61,16 @@
           $schema['fields'][$field_name]['not null'] = TRUE;
           break;
 
+        case 'entity_type':
+        case 'field_name':
+          assert($storage_definition instanceof RequiredFieldStorageDefinitionInterface);
+          if ($storage_definition->isStorageRequired()) {
+            // The 'entity_type' and 'field_name' are required so they also need
+            // to be marked as NOT NULL.
+            $schema['fields'][$field_name]['not null'] = TRUE;
+          }
+          break;
+
         case 'created':
           $this->addSharedTableFieldIndex($storage_definition, $schema, TRUE);
           break;