1.20.x system.install | system_update_1007() |
Create the tempstore table and remove the cache_form table.
Related topics
File
- modules/
system/ system.install, line 1744 - Install, update and uninstall functions for the system module.
Code
function system_update_1007() {
$schema = array(
'description' => 'Generic temporary 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.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('collection', 'name'),
'indexes' => array(
'all' => array('name', 'collection', 'expire'),
'expire' => array('expire'),
),
);
if (!db_table_exists('tempstore')) {
db_create_table('tempstore', $schema);
}
if (db_table_exists('cache_form')) {
db_drop_table('cache_form');
}
}