You are here

function media_schema in D7 Media 7

Implements hook_schema().

File

./media.install, line 13
Install, update and uninstall functions for the Media module.

Code

function media_schema() {
  $schema['media_type'] = array(
    'description' => 'Stores the settings for media types.',
    'fields' => array(
      'name' => array(
        'description' => 'The machine name of the media type.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'label' => array(
        'description' => 'The label of the media type.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'base' => array(
        'description' => 'If this is a base type (i.e. cannot be deleted)',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
      ),
      'weight' => array(
        'description' => 'Weight of media type. Determines which one wins when claiming a piece of media (first wins)',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'normal',
      ),
      'type_callback' => array(
        'description' => 'Callback to determine if provided media is of this type.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
        'default' => '',
      ),
      'type_callback_args' => array(
        'type' => 'text',
        'not null' => FALSE,
        'size' => 'big',
        'serialize' => TRUE,
        'description' => 'A serialized array of name value pairs that will be passed to the callback function',
      ),
    ),
    'primary key' => array(
      'name',
    ),
  );
  $schema['media_list_type'] = array(
    'description' => 'Stores the user preference for whether to list as table or images.',
    'fields' => array(
      'uid' => array(
        'description' => 'The {user}.uid of the user.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'type' => array(
        'description' => 'The type of display (table or images).',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'uid',
    ),
  );
  $schema['media_filter_usage'] = array(
    'description' => 'Stores fids that have been included in the media tag in formatted textareas.',
    'fields' => array(
      'fid' => array(
        'description' => 'The media {file_managed}.fid.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'timestamp' => array(
        'description' => 'The timestamp the fid was last recorded by media_filter()',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'foreign keys' => array(
      'file_managed' => array(
        'table' => 'file_managed',
        'columns' => array(
          'fid' => 'fid',
        ),
      ),
    ),
    'primary key' => array(
      'fid',
    ),
    'indexes' => array(
      'timestamp' => array(
        'timestamp',
      ),
    ),
  );
  $schema['cache_media_xml'] = drupal_get_schema_unprocessed('system', 'cache');
  $schema['cache_media_xml']['description'] = 'Cache table for the the results of retreived XML documents for remote streams.';
  return $schema;
}