You are here

function kaltura_schema in Kaltura 6

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

Implementation of hook_schema().

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

1 call to kaltura_schema()
node_kaltura_entry_update in plugins/node_kaltura_entry/node_kaltura_entry.module
Implementation of hook_update().

File

./kaltura.install, line 17

Code

function kaltura_schema() {
  $schema['node_kaltura'] = array(
    'description' => 'The base table for Kaltura nodes.',
    'fields' => array(
      'vid' => array(
        'description' => 'The current {node_revisions}.vid version identifier.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'nid' => array(
        'description' => 'The primary identifier for a node.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'kaltura_entryId' => array(
        'description' => '',
        'type' => 'varchar',
        'length' => 10,
        'default' => "",
        'not null' => TRUE,
      ),
      'kaltura_tags' => array(
        'description' => 'tags from kaltura CW',
        'type' => 'text',
        'default' => '',
        'not null' => FALSE,
      ),
      'kaltura_admin_tags' => array(
        'description' => 'admin tags from kaltura CMS',
        'type' => 'text',
        'default' => '',
        '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,
      ),
      '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,
      ),
      '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' => 'datetime',
        '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,
      ),
      '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,
      ),
      'kaltura_video_comment' => array(
        'description' => 'was the entry added as a comment for another node or not',
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'vid',
    ),
  );
  $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' => '',
        'not null' => FALSE,
      ),
      'received_at' => array(
        'type' => 'datetime',
      ),
    ),
    'primary key' => array(
      'notification_id',
    ),
  );
  return $schema;
}