#Redo review role default permissions

alter table PS_ALL_USER drop constraint FK5C45A285CF03846B;
alter table PS_ANON drop constraint FK1AEE3388CF03846B;
alter table PS_GROUP drop constraint FK432E9D23CF03846B;
alter table PS_REVIEW_ROLE drop constraint FK97DB18C1CF03846B;
alter table PS_USER drop constraint FK1AF75C87CF03846B;

delete from PS_REVIEW_ROLE where PS = 1;

INSERT INTO PS_REVIEW_ROLE VALUES(1,'Author','action:commentOnReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Author','action:submitReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Author','action:viewReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Creator','action:abandonReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Creator','action:commentOnReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Creator','action:modifyReviewFiles');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Creator','action:recoverReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Creator','action:reopenReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Creator','action:submitReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Creator','action:viewReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Moderator','action:abandonReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Moderator','action:approveReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Moderator','action:closeReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Moderator','action:commentOnReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Moderator','action:modifyReviewFiles');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Moderator','action:recoverReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Moderator','action:rejectReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Moderator','action:reopenReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Moderator','action:summarizeReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Moderator','action:viewReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Reviewer','action:commentOnReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Reviewer','action:completeReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Reviewer','action:uncompleteReview');
INSERT INTO PS_REVIEW_ROLE VALUES(1,'Reviewer','action:viewReview');

alter table PS_ALL_USER add constraint FK5C45A285CF03846B foreign key (ps) references PERM_SCHEME;
alter table PS_ANON add constraint FK1AEE3388CF03846B foreign key (ps) references PERM_SCHEME;
alter table PS_GROUP add constraint FK432E9D23CF03846B foreign key (ps) references PERM_SCHEME;
alter table PS_REVIEW_ROLE add constraint FK97DB18C1CF03846B foreign key (ps) references PERM_SCHEME;
alter table PS_USER add constraint FK1AF75C87CF03846B foreign key (ps) references PERM_SCHEME;

UPDATE CRUVERSION SET version = 21 WHERE version_id = 1;
