View source
<?php
function media_metadata_install() {
drupal_install_schema('media_metadata');
}
function media_metadata_uninstall() {
drupal_uninstall_schema('media_metadata');
db_query("DELETE FROM {variable} WHERE name LIKE 'media_metadata_%'");
}
function media_metadata_schema() {
$schema['media_metadata'] = array(
'description' => 'Stores file resource metadata.',
'fields' => array(
'mid' => array(
'description' => 'The primary identifier for a metadata pair.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'fid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Primary Key: The {files}.fid.',
),
'name' => array(
'default' => '',
'description' => 'The metadata key name.',
'length' => 255,
'not null' => TRUE,
'type' => 'varchar',
),
'data' => array(
'type' => 'text',
'not null' => FALSE,
'description' => 'The value of metadata value pairs that are related to the file resource.',
),
),
'primary key' => array(
'mid',
),
'indexes' => array(
'fid',
'name',
),
);
return $schema;
}