drop procedure if exists schema_change;
delimiter ';;';
create procedure schema_change() begin
if exists (select * from information_schema.columns where table_name = 'sales_order' and column_name = 'has_sent')
then
alter table sales_order drop column has_sent;
end if;
alter table sales_order add column has_sent boolean;
end;;
delimiter ';';
call schema_change();
drop procedure if exists schema_change;