Slight looks change, nothing technical

This commit is contained in:
Thastertyn 2024-03-08 14:03:52 +01:00
parent 1aca8888d2
commit eb57a10bbe

View File

@ -18,8 +18,8 @@ create table user_role(
role varchar(32) not null unique role varchar(32) not null unique
); );
insert into user_role(role) values ('normal') insert into user_role(id, role) values (1, 'normal');
insert into user_role(role) values ('admin') insert into user_role(id, role) values (2, 'admin');
create table user_statistics( create table user_statistics(
id int primary key, id int primary key,
@ -77,7 +77,6 @@ create table purchase_item(
foreign key (product_id) references product(id) foreign key (product_id) references product(id)
); );
delimiter //
create trigger after_user_insert create trigger after_user_insert
after insert after insert
on user for each row on user for each row
@ -85,10 +84,7 @@ begin
insert into user_statistics(id) values (new.id); insert into user_statistics(id) values (new.id);
insert into cart(id) values (new.id); insert into cart(id) values (new.id);
end; end;
//
delimiter;
delimiter //
create trigger after_user_delete create trigger after_user_delete
after delete after delete
on user for each row on user for each row
@ -96,10 +92,7 @@ begin
delete from user_statistics where id = old.id; delete from user_statistics where id = old.id;
delete from cart where id = old.id; delete from cart where id = old.id;
end; end;
//
delimiter;
delimiter //
create trigger after_cart_insert create trigger after_cart_insert
after insert after insert
on cart_item for each row on cart_item for each row
@ -112,10 +105,7 @@ begin
) )
where id = new.cart_id; where id = new.cart_id;
end; end;
//
delimiter;
delimiter //
create trigger after_cart_delete create trigger after_cart_delete
after delete after delete
on cart_item for each row on cart_item for each row
@ -129,10 +119,7 @@ begin
) )
where id = old.cart_id; where id = old.cart_id;
end; end;
//
delimiter;
delimiter //
create trigger calculate_price_subtotal create trigger calculate_price_subtotal
before insert on cart_item before insert on cart_item
for each row for each row
@ -142,6 +129,4 @@ begin
from product p from product p
where p.id = new.product_id where p.id = new.product_id
); );
end; end;
//
delimiter;