You are here

function video_schema in Video 7

Same name and namespace in other branches
  1. 6.5 video.install \video_schema()
  2. 6 video.install \video_schema()
  3. 6.2 video.install \video_schema()
  4. 6.3 video.install \video_schema()
  5. 6.4 video.install \video_schema()
  6. 7.2 video.install \video_schema()

Implementation of hook_schema().

File

./video.install, line 13
Provides installation schema for video.module @author Heshan Wanigasooriya <heshan@heidisoft.com>

Code

function video_schema() {

  // video files
  $schema['video_files'] = array(
    'description' => 'Store video transcoding queue.',
    'fields' => array(
      'vid' => array(
        'description' => t('Video id, the primary identifier'),
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'fid' => array(
        'description' => 'The {file_managed}.fid being referenced in this field.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'nid' => array(
        'description' => 'The {node}.nid being referenced in this field.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'status' => array(
        'description' => 'Status of the transcoding, possible values are 1, 5, 10, 20',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'dimensions' => array(
        'description' => 'The dimensions of the output video.',
        'type' => 'varchar',
        'length' => '255',
        'default' => '',
      ),
      'started' => array(
        'description' => t('Start timestamp of transcodings'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'completed' => array(
        'description' => 'Transcoding completed timestamp',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'data' => array(
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
        'serialize' => TRUE,
        'description' => 'A serialized array of converted files.
          Use of this field is discouraged and it will likely disappear in a future version of Drupal.',
      ),
    ),
    'indexes' => array(
      'status' => array(
        'status',
      ),
      'file' => array(
        'fid',
      ),
    ),
    'primary key' => array(
      'vid',
    ),
  );

  // video preset
  $schema['video_preset'] = array(
    'description' => 'The preset table.',
    'fields' => array(
      'pid' => array(
        'description' => 'The primary identifier for a video preset.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => 'The name of this preset.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'description' => array(
        'description' => 'A brief description of this preset.',
        'type' => 'text',
        'size' => 'medium',
        'translatable' => TRUE,
      ),
      'settings' => array(
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
        'serialize' => TRUE,
        'description' => 'Serialized preset settings that do not warrant a dedicated column.
          Use of this field is discouraged and it will likely disappear in a future version of Drupal.',
      ),
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
    'primary key' => array(
      'pid',
    ),
  );

  // video thumbnails
  $schema['video_thumbnails'] = array(
    'description' => 'The video thumbnails table.',
    'fields' => array(
      'vid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Foreign Key {video_files}.fid.',
      ),
      'thumbnails' => array(
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
        'serialize' => TRUE,
        'description' => 'Serialized array of thumbnails data.
          Use of this field is discouraged and it will likely disappear in a future version of Drupal.',
      ),
    ),
    'indexes' => array(
      'thumbnail' => array(
        'vid',
      ),
    ),
    'foreign keys' => array(
      'thumbnails' => array(
        'table' => 'video_files',
        'columns' => array(
          'vid' => 'vid',
        ),
      ),
    ),
  );
  return $schema;
}