comparison core/modules/comment/src/CommentStorageSchema.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
3 namespace Drupal\comment; 3 namespace Drupal\comment;
4 4
5 use Drupal\Core\Entity\ContentEntityTypeInterface; 5 use Drupal\Core\Entity\ContentEntityTypeInterface;
6 use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema; 6 use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
7 use Drupal\Core\Field\FieldStorageDefinitionInterface; 7 use Drupal\Core\Field\FieldStorageDefinitionInterface;
8 use Drupal\Core\Field\RequiredFieldStorageDefinitionInterface;
8 9
9 /** 10 /**
10 * Defines the comment schema handler. 11 * Defines the comment schema handler.
11 */ 12 */
12 class CommentStorageSchema extends SqlContentEntityStorageSchema { 13 class CommentStorageSchema extends SqlContentEntityStorageSchema {
58 // Improves the performance of the comment__num_new index defined 59 // Improves the performance of the comment__num_new index defined
59 // in getEntitySchema(). 60 // in getEntitySchema().
60 $schema['fields'][$field_name]['not null'] = TRUE; 61 $schema['fields'][$field_name]['not null'] = TRUE;
61 break; 62 break;
62 63
64 case 'entity_type':
65 case 'field_name':
66 assert($storage_definition instanceof RequiredFieldStorageDefinitionInterface);
67 if ($storage_definition->isStorageRequired()) {
68 // The 'entity_type' and 'field_name' are required so they also need
69 // to be marked as NOT NULL.
70 $schema['fields'][$field_name]['not null'] = TRUE;
71 }
72 break;
73
63 case 'created': 74 case 'created':
64 $this->addSharedTableFieldIndex($storage_definition, $schema, TRUE); 75 $this->addSharedTableFieldIndex($storage_definition, $schema, TRUE);
65 break; 76 break;
66 77
67 case 'uid': 78 case 'uid':