-- Add parent column to blocks and iplist tables, add ipcount column to blocks table
-- Note you will need to run setparents.pl after applying this to the
-- database in order to properly populate the new columns.

alter table blocks add column parent cidr;
create index blocks_parent_index on blocks (parent);
update blocks set parent='0/0';
alter table blocks alter column parent set not null;

alter table blocks add column ipcount integer;
update blocks set ipcount=0;
alter table blocks alter column ipcount set not null;

alter table iplist add column parent cidr;
create index ip_parent_index on iplist (parent);
update iplist set parent='0/0';
alter table iplist alter column parent set not null;
