126 lines
3.6 KiB
Plaintext
126 lines
3.6 KiB
Plaintext
<?php
|
|
|
|
/**
|
|
* @file
|
|
* Install, update and uninstall functions for the custom block module.
|
|
*/
|
|
|
|
use Drupal\Core\Entity\EntityTypeInterface;
|
|
|
|
/**
|
|
* Implements hook_schema().
|
|
*/
|
|
function block_content_schema() {
|
|
$schema = array();
|
|
$schema['block_content'] = array(
|
|
'description' => 'Stores contents of custom-made blocks.',
|
|
'fields' => array(
|
|
'id' => array(
|
|
'type' => 'serial',
|
|
'unsigned' => TRUE,
|
|
'not null' => TRUE,
|
|
'description' => "The block's {block_content}.id.",
|
|
),
|
|
'uuid' => array(
|
|
'description' => 'Unique Key: Universally unique identifier for this entity.',
|
|
'type' => 'varchar',
|
|
'length' => 128,
|
|
'not null' => FALSE,
|
|
),
|
|
'info' => array(
|
|
'type' => 'varchar',
|
|
'length' => 128,
|
|
'not null' => TRUE,
|
|
'default' => '',
|
|
'description' => 'Block description.',
|
|
),
|
|
// Defaults to NULL in order to avoid a brief period of potential
|
|
// deadlocks on the index.
|
|
'revision_id' => array(
|
|
'description' => 'The current {block_content_revision}.revision_id version identifier.',
|
|
'type' => 'int',
|
|
'unsigned' => TRUE,
|
|
'not null' => FALSE,
|
|
'default' => NULL,
|
|
),
|
|
'type' => array(
|
|
'description' => 'The type of this custom block.',
|
|
'type' => 'varchar',
|
|
'length' => EntityTypeInterface::BUNDLE_MAX_LENGTH,
|
|
'not null' => TRUE,
|
|
'default' => '',
|
|
),
|
|
'changed' => array(
|
|
'description' => 'The Unix timestamp when the custom block was most recently saved.',
|
|
'type' => 'int',
|
|
'not null' => TRUE,
|
|
'default' => 0,
|
|
),
|
|
'langcode' => array(
|
|
'description' => 'The {language}.langcode of this node.',
|
|
'type' => 'varchar',
|
|
'length' => 12,
|
|
'not null' => TRUE,
|
|
'default' => '',
|
|
),
|
|
),
|
|
'primary key' => array('id'),
|
|
'indexes' => array(
|
|
'block_content_type' => array('type'),
|
|
),
|
|
'unique keys' => array(
|
|
'revision_id' => array('revision_id'),
|
|
'uuid' => array('uuid'),
|
|
'info' => array('info'),
|
|
),
|
|
'foreign keys' => array(
|
|
'block_content_revision' => array(
|
|
'table' => 'block_content_revision',
|
|
'columns' => array('revision_id' => 'revision_id'),
|
|
),
|
|
),
|
|
);
|
|
|
|
$schema['block_content_revision'] = array(
|
|
'description' => 'Stores contents of custom-made blocks.',
|
|
'fields' => array(
|
|
'id' => array(
|
|
'type' => 'int',
|
|
'unsigned' => TRUE,
|
|
'not null' => TRUE,
|
|
'default' => 0,
|
|
'description' => "The block's {block_content}.id.",
|
|
),
|
|
// Defaults to NULL in order to avoid a brief period of potential
|
|
// deadlocks on the index.
|
|
'revision_id' => array(
|
|
'description' => 'The current version identifier.',
|
|
'type' => 'serial',
|
|
'unsigned' => TRUE,
|
|
'not null' => TRUE,
|
|
),
|
|
'revision_log' => array(
|
|
'description' => 'The log entry explaining the changes in this version.',
|
|
'type' => 'text',
|
|
'not null' => FALSE,
|
|
'size' => 'big',
|
|
),
|
|
'info' => array(
|
|
'type' => 'varchar',
|
|
'length' => 128,
|
|
'not null' => TRUE,
|
|
'default' => '',
|
|
'description' => 'Block description.',
|
|
),
|
|
'changed' => array(
|
|
'description' => 'The Unix timestamp when the version was most recently saved.',
|
|
'type' => 'int',
|
|
'not null' => TRUE,
|
|
'default' => 0,
|
|
),
|
|
),
|
|
'primary key' => array('revision_id'),
|
|
);
|
|
return $schema;
|
|
}
|