diff --git a/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandler.php b/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandler.php index 51e7a67..d0a0b1a 100644 --- a/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandler.php +++ b/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandler.php @@ -158,7 +158,11 @@ protected function addFieldSchema(array &$schema, $field_name, array $column_map // table. For this reason the revision ID field cannot be marked as NOT // NULL. unset($keys['label'], $keys['revision']); - $schema['fields'][$schema_field_name]['not null'] = in_array($field_name, $keys); + // Key fields may not be NULL. + $is_required = in_array($field_name, $keys); + if ($is_required) { + $schema['fields'][$schema_field_name]['not null'] = $is_required; + } } if (!empty($field_schema['indexes'])) {