You are here

function kaltura_schema in Kaltura 7.3

Same name and namespace in other branches
  1. 5 kaltura.install \kaltura_schema()
  2. 6.2 kaltura.install \kaltura_schema()
  3. 6 kaltura.install \kaltura_schema()
  4. 7.2 kaltura.install \kaltura_schema()

Implements hook_schema().

Defines the tables and fields in each table that we add to the database to store kaltura data (nodes/notifications...).

File

./kaltura.install, line 13
Installation process for kaltura core module.

Code

function kaltura_schema() {
  $schema['node_kaltura'] = array(
    'description' => 'The base table for Kaltura nodes.',
    'fields' => array(
      'eid' => array(
        'description' => 'The primary identifier for an entity.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'kaltura_entryid' => array(
        'description' => 'Kaltura entry id',
        'type' => 'varchar',
        'length' => 10,
        'default' => '',
        'not null' => TRUE,
      ),
      'kaltura_tags' => array(
        'description' => 'tags from kaltura CW',
        'type' => 'text',
        'default' => NULL,
        'not null' => FALSE,
      ),
      'kaltura_admin_tags' => array(
        'description' => 'admin tags from kaltura CMS',
        'type' => 'text',
        'default' => NULL,
        'not null' => FALSE,
      ),
      'kstatus' => array(
        'description' => 'The status of the entry/roughcut',
        'type' => 'int',
        'size' => 'small',
        'default' => 0,
        'not null' => TRUE,
      ),
      'kaltura_media_type' => array(
        'description' => 'Media type of the entry/mix. see kaltura API documentation for values',
        'type' => 'int',
        'size' => 'small',
        'not null' => FALSE,
      ),
      'kaltura_duration' => array(
        'description' => 'The duration of the entry(msecs)/mix(secs) in seconds',
        'type' => 'int',
        'not null' => FALSE,
      ),
      'kaltura_thumbnail_url' => array(
        'description' => 'The url of the thumbnail for the entry',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
      'kaltura_partner_data' => array(
        'description' => 'partner data that was sent in addentry',
        'type' => 'varchar',
        'length' => 4096,
        'not null' => FALSE,
      ),
      'kaltura_source' => array(
        'description' => 'The source of the media (file,webcam,youtube etc.), see kaltura API documentation for values',
        'type' => 'int',
        'size' => 'small',
        'not null' => FALSE,
      ),
      // @todo This field is not used and not even fetched from remote. Remove?
      'kaltura_source_id' => array(
        'description' => 'The id of the media in the source (e.g. youtube video id)',
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
      // @todo This field is not used and not even fetched from remote. Remove?
      'kaltura_source_link' => array(
        'description' => 'The link of the media source',
        'type' => 'varchar',
        'length' => 1024,
        'not null' => FALSE,
      ),
      'kaltura_width' => array(
        'description' => 'if item is image - the width of the image',
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
      'kaltura_height' => array(
        'description' => 'if item is image - the height of the image',
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
      'kaltura_download_url' => array(
        'description' => 'The direct download url for the entry/mix. available if item was flattened',
        'type' => 'varchar',
        'length' => 1024,
        'not null' => FALSE,
      ),
      'kaltura_media_date' => array(
        'description' => 'Date of the image from exif data',
        'type' => 'int',
        'not null' => FALSE,
      ),
      // A-sync data fields which should be updated by cron.
      'kaltura_views' => array(
        'description' => 'The number of times this item was viewed not necessarily played',
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
      'kaltura_plays' => array(
        'description' => 'The number of times this item was played',
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
      'kaltura_votes' => array(
        'description' => 'The number of votes on the entry/mix',
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
      'kaltura_rank' => array(
        'description' => 'the calculated rank of the entry/mix - multiplied by 1000',
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
      'kaltura_total_rank' => array(
        'description' => 'total rank of the entry/mix',
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
      // @todo This field is not used and not even fetched from remote. Remove?
      'kaltura_entry_data' => array(
        'description' => 'All the entry/kshow data (serialized) from kaltura received from notification or API call',
        'type' => 'text',
        'default' => NULL,
        'not null' => FALSE,
      ),
      // @todo This field is not used and not even fetched from remote. Remove?
      'kaltura_video_comment' => array(
        'description' => 'was the entry added as a comment for another node or not',
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
      'kaltura_created_date' => array(
        'description' => 'The date and time the entry was created',
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
      'kaltura_updated_date' => array(
        'description' => 'The date and time the entry was updated',
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
      'kaltura_title' => array(
        'description' => 'The entry title',
        'type' => 'text',
        'default' => NULL,
        'not null' => FALSE,
      ),
      'kaltura_description' => array(
        'description' => 'The entry description',
        'type' => 'text',
        'default' => NULL,
        'not null' => FALSE,
      ),
      'kaltura_puser_id' => array(
        'description' => 'Uploader user id',
        'type' => 'int',
        'default' => 1,
        'not null' => TRUE,
      ),
      'categories' => array(
        'description' => 'Categories the media belongs to',
        'type' => 'text',
        'default' => NULL,
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'eid',
    ),
    'unique keys' => array(
      'kaltura_entryid' => array(
        'kaltura_entryid',
      ),
    ),
    'foreign keys' => array(
      'owner' => array(
        'table' => 'users',
        'columns' => array(
          'kaltura_puser_id' => 'uid',
        ),
      ),
    ),
  );
  $schema['kaltura_notifications'] = array(
    'description' => 'table to "log" kaltura notifications, to ignore double notifications',
    'fields' => array(
      'notification_id' => array(
        'description' => 'notification Id from kaltura',
        'type' => 'int',
        'size' => 'normal',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'data' => array(
        'description' => 'notification REQUEST params',
        'type' => 'text',
        'default' => NULL,
        'not null' => FALSE,
      ),
      'received_at' => array(
        'type' => 'int',
      ),
    ),
    'primary key' => array(
      'notification_id',
    ),
  );
  return $schema;
}