3 namespace Drupal\paragraphs;
5 use Drupal\Core\Entity\ContentEntityTypeInterface;
6 use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
7 use Drupal\Core\Field\FieldStorageDefinitionInterface;
10 * Extends the paragraphs schema handler.
12 class ParagraphStorageSchema extends SqlContentEntityStorageSchema {
17 protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) {
18 $schema = parent::getEntitySchema($entity_type, $reset);
20 $schema['paragraphs_item_field_data']['indexes'] += array(
21 'paragraphs__parent_fields' => array('parent_type', 'parent_id', 'parent_field_name'),
30 protected function getSharedTableFieldSchema(FieldStorageDefinitionInterface $storage_definition, $table_name, array $column_mapping) {
31 // Setting the initial value to 1 when we add a 'status' field.
32 // @todo this is a workaround for https://www.drupal.org/node/2346019
33 $schema = parent::getSharedTableFieldSchema($storage_definition, $table_name, $column_mapping);
34 if ($storage_definition->getName() == 'status') {
35 $schema['fields']['status']['initial'] = 1;
38 if ($storage_definition->getName() == 'behavior_settings') {
39 $schema['fields']['behavior_settings']['initial'] = serialize([]);