Slight looks change, nothing technical
This commit is contained in:
parent
1aca8888d2
commit
eb57a10bbe
21
shop.sql
21
shop.sql
@ -18,8 +18,8 @@ create table user_role(
|
||||
role varchar(32) not null unique
|
||||
);
|
||||
|
||||
insert into user_role(role) values ('normal')
|
||||
insert into user_role(role) values ('admin')
|
||||
insert into user_role(id, role) values (1, 'normal');
|
||||
insert into user_role(id, role) values (2, 'admin');
|
||||
|
||||
create table user_statistics(
|
||||
id int primary key,
|
||||
@ -77,7 +77,6 @@ create table purchase_item(
|
||||
foreign key (product_id) references product(id)
|
||||
);
|
||||
|
||||
delimiter //
|
||||
create trigger after_user_insert
|
||||
after insert
|
||||
on user for each row
|
||||
@ -85,10 +84,7 @@ begin
|
||||
insert into user_statistics(id) values (new.id);
|
||||
insert into cart(id) values (new.id);
|
||||
end;
|
||||
//
|
||||
delimiter;
|
||||
|
||||
delimiter //
|
||||
create trigger after_user_delete
|
||||
after delete
|
||||
on user for each row
|
||||
@ -96,10 +92,7 @@ begin
|
||||
delete from user_statistics where id = old.id;
|
||||
delete from cart where id = old.id;
|
||||
end;
|
||||
//
|
||||
delimiter;
|
||||
|
||||
delimiter //
|
||||
create trigger after_cart_insert
|
||||
after insert
|
||||
on cart_item for each row
|
||||
@ -112,10 +105,7 @@ begin
|
||||
)
|
||||
where id = new.cart_id;
|
||||
end;
|
||||
//
|
||||
delimiter;
|
||||
|
||||
delimiter //
|
||||
create trigger after_cart_delete
|
||||
after delete
|
||||
on cart_item for each row
|
||||
@ -129,10 +119,7 @@ begin
|
||||
)
|
||||
where id = old.cart_id;
|
||||
end;
|
||||
//
|
||||
delimiter;
|
||||
|
||||
delimiter //
|
||||
create trigger calculate_price_subtotal
|
||||
before insert on cart_item
|
||||
for each row
|
||||
@ -142,6 +129,4 @@ begin
|
||||
from product p
|
||||
where p.id = new.product_id
|
||||
);
|
||||
end;
|
||||
//
|
||||
delimiter;
|
||||
end;
|
Loading…
x
Reference in New Issue
Block a user