function file_entity_update_7201 in File Entity (fieldable files) 7.2
Same name and namespace in other branches
- 7.3 file_entity.install \file_entity_update_7201()
Add the {file_type}, {file_type_mimetypes} tables.
File
- ./
file_entity.install, line 444 - Install, update and uninstall functions for the file_entity module.
Code
function file_entity_update_7201() {
$schema = array(
'description' => 'Stores the settings for file types.',
'fields' => array(
'type' => array(
'description' => 'The machine name of the file type.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'label' => array(
'description' => 'The human readable name of the file type.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'translatable' => TRUE,
),
'description' => array(
'description' => 'A brief description of this file type.',
'type' => 'text',
'not null' => TRUE,
'size' => 'medium',
'translatable' => TRUE,
),
),
'primary key' => array(
'type',
),
'export' => array(
'key' => 'type',
'key name' => 'Type',
'primary key' => 'type',
'default hook' => 'file_default_types',
'identifier' => 'file_type',
'export type string' => 'ctools_type',
'subrecords callback' => 'file_type_load_subrecords',
'save callback' => 'file_type_save',
'delete callback' => 'file_type_delete',
'api' => array(
'owner' => 'file_entity',
'api' => 'file_type',
'minimum_version' => 1,
'current_version' => 1,
),
),
);
if (!db_table_exists('file_type')) {
db_create_table('file_type', $schema);
}
$schema = array(
'description' => 'Maps mimetypes to file types.',
'fields' => array(
'type' => array(
'description' => 'The machine name of the file type.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'mimetype' => array(
'description' => 'Mimetypes mapped to this file type.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
),
'indexes' => array(
'file_type' => array(
'type',
),
'file_type_mimetype' => array(
'mimetype',
),
),
);
if (!db_table_exists('file_type_mimetypes')) {
db_create_table('file_type_mimetypes', $schema);
}
}