Skip to content

Instantly share code, notes, and snippets.

@jenglert
Created August 22, 2009 22:13
Show Gist options
  • Save jenglert/173014 to your computer and use it in GitHub Desktop.
Save jenglert/173014 to your computer and use it in GitHub Desktop.
#Custom SQL
execute "create or replace view vw_feed_parse_stats as (select feed_id, dayofyear(parse_start) dayofyear, feed_items_added from feed_parse_logs group by dayofyear(parse_start), feed_id);"
execute "alter table feed_item_categories add constraint category_fk foreign key (category_id) references categories(id);"
change_column :feed_item_categories, :feed_item_id, :integer
execute "alter table feed_item_categories add constraint feed_item_fk foreign key (feed_item_id) references feed_items(id);"
execute "alter table feed_items add constraint feed_fk foreign key (feed_id) references feeds(id);"
execute "alter table feed_parse_logs add constraint fpl_feed_fk foreign key (feed_id) references feeds(id);"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment