You are here

function kaltura_schema in Kaltura 5

Same name and namespace in other branches
  1. 6.2 kaltura.install \kaltura_schema()
  2. 6 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 16

Code

function kaltura_schema() {
  $schema['node_kaltura'] = array(
    'description' => t('The base table for Kaltura nodes.'),
    'fields' => array(
      'vid' => array(
        'description' => t('The current {node_revisions}.vid version identifier.'),
        'type' => 'int',
        'size' => 'small',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'nid' => array(
        'description' => t('The primary identifier for a node.'),
        'type' => 'int',
        'size' => 'small',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'kaltura_entryId' => array(
        'description' => t('none'),
        'type' => 'varchar',
        'length' => 10,
        'default' => "",
        'not null' => TRUE,
      ),
      'kaltura_tags' => array(
        'description' => t('tags from kaltura CW'),
        'type' => 'text',
        'default' => '',
        'not null' => FALSE,
      ),
      'kaltura_admin_tags' => array(
        'description' => t('admin tags from kaltura CMS'),
        'type' => 'text',
        'default' => '',
        'not null' => FALSE,
      ),
      'kstatus' => array(
        'description' => t('The status of the entry/roughcut'),
        'type' => 'int',
        'size' => 'small',
        'default' => 0,
        'not null' => TRUE,
      ),
      'kaltura_media_type' => array(
        'description' => t('Media type of the entry/mix. see kaltura API documentation for values'),
        'type' => 'int',
        'size' => 'small',
        'not null' => FALSE,
      ),
      'kaltura_duration' => array(
        'description' => t('The duration of the entry(msecs)/mix(secs) in seconds'),
        'type' => 'int',
        'not null' => FALSE,
      ),
      'kaltura_thumbnail_url' => array(
        'description' => t('The url of the thumbnail for the entry'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
      'kaltura_partner_data' => array(
        'description' => t('partner data that was sent in addentry'),
        'type' => 'varchar',
        'length' => 4096,
        'not null' => FALSE,
      ),
      'kaltura_source' => array(
        'description' => t('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' => t('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' => t('The link of the media source'),
        'type' => 'varchar',
        'length' => 1024,
        'not null' => FALSE,
      ),
      'kaltura_width' => array(
        'description' => t('if item is image - the width of the image'),
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
      'kaltura_height' => array(
        'description' => t('if item is image - the height of the image'),
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
      'kaltura_download_url' => array(
        'description' => t('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' => t('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' => t('The number of times this item was viewed (not necessarily played)'),
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
      'kaltura_plays' => array(
        'description' => t('The number of times this item was played'),
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
      'kaltura_votes' => array(
        'description' => t('The number of votes on the entry/mix'),
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
      'kaltura_rank' => array(
        'description' => t('the calculated rank of the entry/mix - multiplied by 1000'),
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
      'kaltura_total_rank' => array(
        'description' => t('total rank of the entry/mix'),
        'type' => 'int',
        'default' => 0,
        'not null' => FALSE,
      ),
      'kaltura_entry_data' => array(
        'description' => t('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' => t('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' => t('table to "log" kaltura notifications, to ignore double notifications'),
    'fields' => array(
      'notification_id' => array(
        'description' => t('notification Id from kaltura'),
        'type' => 'int',
        'size' => 'normal',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'data' => array(
        'description' => t('notification REQUEST params'),
        'type' => 'text',
        'default' => '',
        'not null' => FALSE,
      ),
      'received_at' => array(
        'type' => 'datetime',
      ),
    ),
    'primary key' => array(
      'notification_id',
    ),
  );
  return $schema;
}