You are here

function content_lock_schema in Content locking (anti-concurrent editing) 8

Same name and namespace in other branches
  1. 8.2 content_lock.install \content_lock_schema()
  2. 6.2 content_lock.install \content_lock_schema()
  3. 6 content_lock.install \content_lock_schema()
  4. 7.3 content_lock.install \content_lock_schema()
  5. 7 content_lock.install \content_lock_schema()
  6. 7.2 content_lock.install \content_lock_schema()

Implements hook_schema().

File

./content_lock.install, line 15
Create content_lock table.

Code

function content_lock_schema() {
  $schema['content_lock'] = [
    'description' => 'content lock module table.',
    'fields' => [
      'entity_id' => [
        'description' => 'The primary identifier for an entity.',
        'type' => 'int',
        'size' => 'normal',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'entity_type' => [
        'description' => 'The type of an entity.',
        'type' => 'varchar_ascii',
        'length' => EntityTypeInterface::ID_MAX_LENGTH,
        'not null' => TRUE,
      ],
      'form_op' => [
        'description' => 'The entity form operation.',
        'type' => 'varchar',
        'length' => EntityTypeInterface::ID_MAX_LENGTH,
        'not null' => TRUE,
        'default' => '*',
      ],
      'langcode' => [
        'description' => 'The language code of the entity.',
        'type' => 'varchar_ascii',
        'length' => 12,
        'not null' => TRUE,
        'default' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
      ],
      'uid' => [
        'description' => 'User that holds the lock.',
        'type' => 'int',
        'size' => 'normal',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'timestamp' => [
        'description' => 'Time the lock occurred.',
        'size' => 'normal',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
    ],
    'indexes' => [
      'user' => [
        'uid',
      ],
    ],
    'foreign keys' => [
      'uid' => [
        'table' => 'users_field_data',
        'columns' => [
          'uid' => 'uid',
        ],
      ],
    ],
    'primary key' => [
      'entity_id',
      'entity_type',
      'form_op',
      'langcode',
    ],
  ];
  return $schema;
}