Skip to content

Commit

Permalink
wah
Browse files Browse the repository at this point in the history
  • Loading branch information
johnphilip283 committed Dec 9, 2018
1 parent 1368799 commit 7169d3c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sql_script/petsitting_create.sql
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,19 @@ end
delimiter ;

drop trigger if exists check_user_being_rated_is_sitter;
delimiter //
create trigger check_user_being_rated_is_sitter before insert on rating
for each row
begin
if ((select is_sitter
from user
where user.user_id = new.ratee_id) = 0) then
signal sqlstate '45000'
set message_text = ' Cannot enter a rating about someone who is not a sitter.';
end if;
end
//
delimiter ;

drop trigger if exists check_pet_put_up_is_owners;
delimiter //
Expand Down

0 comments on commit 7169d3c

Please sign in to comment.