Implements hook_schema().
function custom_block_schema() {
$schema = array();
$schema['custom_block'] = array(
'description' => 'Stores contents of custom-made blocks.',
'fields' => array(
'id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => "The block's {custom_block}.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_custom_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' => 32,
'not null' => TRUE,
'default' => '',
),
'langcode' => array(
'description' => 'The {language}.langcode of this node.',
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
),
),
'primary key' => array(
'id',
),
'indexes' => array(
'block_custom_type' => array(
array(
'type',
4,
),
),
),
'unique keys' => array(
'revision_id' => array(
'revision_id',
),
'uuid' => array(
'uuid',
),
'info' => array(
'info',
),
),
'foreign keys' => array(
'custom_block_revision' => array(
'table' => 'custom_block_revision',
'columns' => array(
'revision_id' => 'revision_id',
),
),
),
);
$schema['custom_block_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 {custom_block}.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,
),
'log' => array(
'description' => 'The log entry explaining the changes in this version.',
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
),
'info' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'Block description.',
),
),
'primary key' => array(
'revision_id',
),
);
return $schema;
}