ALTER TABLE downloads DROP CONSTRAINT downloads_feed_id_valid;
alter table downloads add constraint downloads_feed_id_valid     check ((feeds_id is not null) or       ( type = 'spider_blog_home' or type = 'spider_posting' or type = 'spider_rss' or type = 'spider_blog_friends_list') );
alter table downloads DROP constraint downloads_story;
alter table downloads add constraint downloads_story    check (((type = 'feed' or type = 'spider_blog_home' or type = 'spider_posting' or type = 'spider_rss' or type = 'spider_blog_friends_list')    and stories_id is null) or (stories_id is not null));
DROP INDEX downloads_spider_urls ;
CREATE INDEX downloads_spider_urls on downloads(url) where type = 'spider_blog_home' or type = 'spider_posting' or type = 'spider_rss' or type = 'spider_blog_friends_list';
DROP INDEX spider_download_errors_to_clear ;
CREATE INDEX spider_download_errors_to_clear on downloads(state,type,error_message) where state='error' and type in ('spider_blog_home','spider_posting','spider_rss','spider_blog_friends_list') and (error_message like '50%' or error_message= 'Download timed out by Fetcher::_timeout_stale_downloads') ;
DROP INDEX spider_download_errors_to_clear on downloads;
DROP INDEX spider_download_errors_to_clear;
CREATE INDEX spider_download_errors_to_clear on downloads(state,type,error_message) where state='error' and type in ('spider_blog_home','spider_posting','spider_rss','spider_blog_friends_list') and (error_message like '50%' or error_message= 'Download timed out by Fetcher::_timeout_stale_downloads') ;

Add change that creates a feed_error download state.
Add change that creates a feed_error download state.


