#first drop changed constraints on the existing tables
#
alter table ACTION_ITEM drop constraint FKE077AB7CE71841CE;
alter table AI_COMMENT drop constraint FK3E2A8128999D94C6;
alter table AI_COMMENT drop constraint FK3E2A8128F020303B;
alter table AI_FIELD drop constraint FK1BEC5603A18837F5;
alter table AI_FIELD drop constraint FK1BEC5603F020303B;
alter table AI_RELATED_COMMENT drop constraint FKFB11BF4999D94C6;
alter table AI_RELATED_COMMENT drop constraint FKFB11BF4F020303B;
#
# add columns title and summary to ACTION_ITEM
alter table ACTION_ITEM ADD COLUMN summary varchar(255);
alter table ACTION_ITEM ADD COLUMN title varchar(255);
#
# delete all rows from ACTION_ITEM
delete from ACTION_ITEM;
#
# Add back constraints and indexes
#
alter table ACTION_ITEM add constraint FKE077AB7CE71841CE foreign key (REVIEW_ID) references REVIEW;
alter table AI_COMMENT add constraint FK3E2A8128999D94C6 foreign key (COMMENT_ID) references COMMENT;
alter table AI_COMMENT add constraint FK3E2A8128F020303B foreign key (ACTION_ITEM_ID) references ACTION_ITEM;
alter table AI_FIELD add constraint FK1BEC5603A18837F5 foreign key (FIELD_ID) references FIELD;
alter table AI_FIELD add constraint FK1BEC5603F020303B foreign key (ACTION_ITEM_ID) references ACTION_ITEM;
alter table AI_RELATED_COMMENT add constraint FKFB11BF4999D94C6 foreign key (COMMENT_ID) references COMMENT;
alter table AI_RELATED_COMMENT add constraint FKFB11BF4F020303B foreign key (ACTION_ITEM_ID) references ACTION_ITEM;
#
# and finally update the db version
#
UPDATE CRUVERSION SET version = 7 WHERE version_id = 1;