You are here

function feeds_update_6004 in Feeds 7

Same name and namespace in other branches
  1. 6 feeds.install \feeds_update_6004()

Add source field to feeds_source, make fields part of PKs not null.

File

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

Code

function feeds_update_6004() {
  $ret = array();
  $spec = array(
    'type' => 'text',
    'not null' => TRUE,
    'description' => 'Main source resource identifier. E. g. a path or a URL.',
  );
  db_add_field($ret, 'feeds_source', 'source', $spec);
  db_add_index($ret, 'feeds_source', 'id_source', array(
    'id',
    array(
      'source',
      255,
    ),
  ));

  // Make feed_nid not null, default 0. It is part of the primary key.
  $spec = array(
    'type' => 'int',
    'not null' => TRUE,
    'default' => 0,
    'unsigned' => TRUE,
    'description' => 'Node nid if this particular source is attached to a feed node.',
  );
  db_change_field($ret, 'feeds_schedule', 'feed_nid', 'feed_nid', $spec);

  // Same thing for feeds_source table.
  $spec = array(
    'type' => 'int',
    'not null' => TRUE,
    'default' => 0,
    'unsigned' => TRUE,
    'description' => 'Node nid if this particular source is attached to a feed node.',
  );
  db_change_field($ret, 'feeds_source', 'feed_nid', 'feed_nid', $spec);
  return $ret;
}