function video_schema in Video 7.2
Same name and namespace in other branches
- 6.5 video.install \video_schema()
- 6 video.install \video_schema()
- 6.2 video.install \video_schema()
- 6.3 video.install \video_schema()
- 6.4 video.install \video_schema()
- 7 video.install \video_schema()
Implements hook_schema().
File
- ./
video.install, line 11 - Provides installation schema for video.module @author Heshan Wanigasooriya <heshan@heidisoft.com>
Code
function video_schema() {
// video queue
$schema['video_queue'] = 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,
),
'entity_type' => array(
'description' => 'The entity_type of the video.',
'type' => 'varchar',
'length' => 128,
'default' => 'node',
),
'entity_id' => array(
'description' => 'The entity_id 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' => '',
),
'duration' => array(
'type' => 'varchar',
'length' => 32,
'not null' => FALSE,
'description' => 'Stores the video duration in Sec.',
),
'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,
),
'statusupdated' => array(
'description' => 'Timestamp of last status update, used to track stuck videos',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'unsigned' => TRUE,
),
'data' => array(
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
'description' => 'A serialized array of converted files.',
),
),
'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.',
),
),
'unique keys' => array(
'name' => array(
'name',
),
),
'primary key' => array(
'pid',
),
);
// video thumbnails
$schema['video_thumbnails'] = array(
'description' => 'Table to store thumbnails associated with each video.',
'fields' => array(
'videofid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'fid of original video.',
),
'thumbnailfid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'fid of thumbnail.',
),
),
'unique keys' => array(
'thumbnail' => array(
'thumbnailfid',
),
),
'primary key' => array(
'videofid',
'thumbnailfid',
),
'foreign keys' => array(
'videofid' => array(
'table' => 'file_managed',
'columns' => array(
'videofid' => 'fid',
),
),
'thumbnailfid' => array(
'table' => 'file_managed',
'columns' => array(
'thumbnailfid' => 'fid',
),
),
),
);
// video converted file reference
$schema['video_output'] = array(
'description' => 'Track file id for converted files.',
'fields' => array(
'vid' => array(
'description' => 'Video identifier.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'original_fid' => array(
'description' => 'Original file identifier.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'output_fid' => array(
'description' => 'Converted file fid.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'job_id' => array(
'description' => 'Referenced job id if any.',
'type' => 'int',
'not null' => FALSE,
'default' => NULL,
),
),
'indexes' => array(
'original_fid' => array(
'original_fid',
),
),
'primary key' => array(
'vid',
'original_fid',
'output_fid',
),
);
return $schema;
}