aboutsummaryrefslogtreecommitdiff
path: root/db/init.sql
diff options
context:
space:
mode:
Diffstat (limited to 'db/init.sql')
-rw-r--r--db/init.sql21
1 files changed, 16 insertions, 5 deletions
diff --git a/db/init.sql b/db/init.sql
index b7b3310..df7aa30 100644
--- a/db/init.sql
+++ b/db/init.sql
@@ -33,19 +33,30 @@ create table if not exists webs.user (
primary key (`id`)
);
-create table if not exists webs.cart (
+create table if not exists webs.order (
`id` int not null auto_increment,
- `product` int not null,
+ `status` int not null default 1,
`user` int not null,
+ primary key (`id`),
+ constraint `order_user_fk`
+ foreign key (`user`)
+ references webs.user (`id`)
+ on update cascade
+);
+
+create table if not exists webs.orderproduct (
+ `id` int not null auto_increment,
+ `product` int not null,
`count` int not null default 1,
+ `order` int not null,
primary key (`id`),
constraint `cart_product_fk`
foreign key (`product`)
references webs.product (`id`)
on update cascade,
- constraint `cart_user_fk`
- foreign key (`user`)
- references webs.user (`id`)
+ constraint `cart_order_fk`
+ foreign key (`order`)
+ references webs.order (`id`)
on update cascade
);