function system_update_7059
7.x system.install | system_update_7059() |
Create the {file_usage} table.
Related topics
File
- drupal-7.x/
modules/ system/ system.install, line 2581 - Install, update and uninstall functions for the system module.
Code
function system_update_7059() {
$spec = array(
'description' => 'Track where a file is used.',
'fields' => array(
'fid' => array(
'description' => 'File ID.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'module' => array(
'description' => 'The name of the module that is using the file.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'type' => array(
'description' => 'The name of the object type in which the file is used.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'id' => array(
'description' => 'The primary key of the object using the file.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'count' => array(
'description' => 'The number of times this file is used by this object.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('fid', 'type', 'id', 'module'),
'indexes' => array(
'type_id' => array('type', 'id'),
'fid_count' => array('fid', 'count'),
'fid_module' => array('fid', 'module'),
),
);
db_create_table('file_usage', $spec);
}