You are here

media_metadata.install in D7 Media 6

File

media_metadata/media_metadata.install
View source
<?php

/**
 * Implementation of hook_install().
 */
function media_metadata_install() {
  drupal_install_schema('media_metadata');
}

/**
 * Implementation of hook_uninstall().
 */
function media_metadata_uninstall() {
  drupal_uninstall_schema('media_metadata');

  // Remove all variables that live in our namespace.
  db_query("DELETE FROM {variable} WHERE name LIKE 'media_metadata_%'");
}

/**
 * Implementation of hook_schema().
 */
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;
}

Functions

Namesort descending Description
media_metadata_install Implementation of hook_install().
media_metadata_schema Implementation of hook_schema().
media_metadata_uninstall Implementation of hook_uninstall().