You are here

function feeds_update_6014 in Feeds 6

Update feeds_term_item to match feeds_node_item.

File

./feeds.install, line 586
Schema definitions install/update/uninstall hooks.

Code

function feeds_update_6014() {
  $ret = array();

  // Define new fields.
  $fields = array(
    'imported' => array(
      'type' => 'int',
      'not null' => TRUE,
      'default' => 0,
      'description' => t('Import date of the feed item, as a Unix timestamp.'),
    ),
    'url' => array(
      'type' => 'text',
      'not null' => TRUE,
      'description' => t('Link to the feed item.'),
    ),
    'guid' => array(
      'type' => 'text',
      'not null' => TRUE,
      'description' => t('Unique identifier for the feed item.'),
    ),
  );

  // Add new fields.
  foreach ($fields as $field => $data) {
    db_add_field($ret, 'feeds_term_item', $field, $data);
  }

  // Add new indexes, drop id_feed_nid.
  db_drop_index($ret, 'feeds_term_item', 'id_feed_nid');
  db_add_index($ret, 'feeds_term_item', 'id', array(
    'id',
  ));
  db_add_index($ret, 'feeds_term_item', 'imported', array(
    'imported',
  ));
  db_add_index($ret, 'feeds_term_item', 'url', array(
    array(
      'url',
      255,
    ),
  ));
  db_add_index($ret, 'feeds_term_item', 'guid', array(
    array(
      'guid',
      255,
    ),
  ));
  return $ret;
}