You are here

public function SerialSQLStorage::getSchema in Serial Field 8

Gets the schema of the assistant storage for generating serial values.

Return value

array Assistant storage schema.

Overrides SerialStorageInterface::getSchema

1 call to SerialSQLStorage::getSchema()
SerialSQLStorage::createStorageFromName in src/SerialSQLStorage.php
Creates an assistant serial storage for a new created field.

File

src/SerialSQLStorage.php, line 116

Class

SerialSQLStorage
Serial storage service definition.

Namespace

Drupal\serial

Code

public function getSchema() {
  $schema = [
    'fields' => [
      'sid' => [
        // Serial Drupal DB type
        // not SerialStorageInterface::SERIAL_FIELD_TYPE
        // means auto increment.
        // https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!database.api.php/group/schemaapi/8.2.x
        'type' => 'serial',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'description' => 'The atomic serial field.',
      ],
      'uniqid' => [
        'type' => 'varchar',
        'length' => 23,
        'default' => '',
        'not null' => TRUE,
        // @todo review UUID instead
        'description' => 'Unique temporary allocation Id.',
      ],
    ],
    'primary key' => [
      'sid',
    ],
    'unique keys' => [
      'uniqid' => [
        'uniqid',
      ],
    ],
  ];
  return $schema;
}