alter table rfqs add total decimal(9, 2) unsigned not null default 0 after notes;
alter table rfqs add insert_date datetime null after total;
alter table rfqs add change_date timestamp not null default current_timestamp on update current_timestamp after insert_date;

update rfqs set insert_date = change_date;

alter table rfqs modify insert_date datetime not null;

alter table rfqs add num_line_items tinyint(3) unsigned not null default 0 after notes;

update rfqs
set num_line_items = (select count(*) from rfq_items where rfq_items.rfq_id = rfqs.id);