You are here

public function DefaultDateRecurOccurrenceHandler::getOccurrenceTableSchema in Recurring Dates Field 8

1 call to DefaultDateRecurOccurrenceHandler::getOccurrenceTableSchema()
DefaultDateRecurOccurrenceHandler::createOccurrenceTable in src/Plugin/DateRecurOccurrenceHandler/DefaultDateRecurOccurrenceHandler.php
Creates an occurrence table.

File

src/Plugin/DateRecurOccurrenceHandler/DefaultDateRecurOccurrenceHandler.php, line 315

Class

DefaultDateRecurOccurrenceHandler
Provides the default occurrence handler.

Namespace

Drupal\date_recur\Plugin\DateRecurOccurrenceHandler

Code

public function getOccurrenceTableSchema(FieldStorageDefinitionInterface $field) {
  $field_name = $field
    ->getName();
  $schema = [
    'fields' => [
      'entity_id' => [
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => "Entity id",
      ],
      'revision_id' => [
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => "Entity revision id",
      ],
      'field_delta' => [
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
      'delta' => [
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
      $field_name . '_value' => [
        'description' => 'Start date',
        'type' => 'varchar',
        'length' => 20,
      ],
      $field_name . '_end_value' => [
        'description' => 'End date',
        'type' => 'varchar',
        'length' => 20,
      ],
    ],
    'indexes' => [
      'value' => [
        'entity_id',
        $field_name . '_value',
      ],
    ],
  ];
  return $schema;
}