| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- /**
- * @file
- * Creates the following tables:
- *
- * - key_value
- * - key_value_expire
- */
- /**
- * Implements hook_schema().
- */
- function service_container_schema() {
- $schema = array();
- $schema['key_value'] = array(
- 'description' => 'Generic key-value storage table. See the state system for an example.',
- 'fields' => array(
- 'collection' => array(
- 'description' => 'A named collection of key and value pairs.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'name' => array(
- 'description' => 'The key of the key-value pair. As KEY is a SQL reserved keyword, name was chosen instead.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'value' => array(
- 'description' => 'The value.',
- 'type' => 'blob',
- 'not null' => TRUE,
- 'size' => 'big',
- ),
- ),
- 'primary key' => array('collection', 'name'),
- );
- $schema['key_value_expire'] = array(
- 'description' => 'Generic key/value storage table with an expiration.',
- 'fields' => array(
- 'collection' => array(
- 'description' => 'A named collection of key and value pairs.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'name' => array(
- // KEY is an SQL reserved word, so use 'name' as the key's field name.
- 'description' => 'The key of the key/value pair.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'value' => array(
- 'description' => 'The value of the key/value pair.',
- 'type' => 'blob',
- 'not null' => TRUE,
- 'size' => 'big',
- ),
- 'expire' => array(
- 'description' => 'The time since Unix epoch in seconds when this item expires. Defaults to the maximum possible time.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 2147483647,
- ),
- ),
- 'primary key' => array('collection', 'name'),
- 'indexes' => array(
- 'all' => array('name', 'collection', 'expire'),
- 'expire' => array('expire'),
- ),
- );
- return $schema;
- }
|