From f3b582307cc3caf5ee0c7514d461e47fb5893bc7 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Mon, 8 May 2023 17:14:06 +0200 Subject: uppercase is dumb --- db/init.sql | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'db/init.sql') diff --git a/db/init.sql b/db/init.sql index a9fc25b..4be1768 100644 --- a/db/init.sql +++ b/db/init.sql @@ -1,61 +1,61 @@ create schema if not exists webs; create table if not exists webs.category ( - `ID` int not null auto_increment, + `id` int not null auto_increment, `name` varchar(45) not null, `parent` int null default null, - primary key (`ID`), + primary key (`id`), constraint `category_parent_fk` foreign key (`parent`) - references webs.category (`ID`) + references webs.category (`id`) on update cascade ); create table if not exists webs.product ( - `ID` int not null auto_increment, + `id` int not null auto_increment, `name` varchar(255) not null, `price` decimal(5, 2) not null, `image` boolean not null default false, `description` mediumtext null default null, `category` int not null, - primary key (`ID`), + primary key (`id`), constraint `product_category_fk` foreign key (`category`) - references webs.category (`ID`) + references webs.category (`id`) on update cascade ); create table if not exists webs.customer ( - `ID` int not null auto_increment, + `id` int not null auto_increment, `name` varchar(45) not null, - primary key (`ID`) + primary key (`id`) ); create table if not exists webs.cart ( - `ID` int not null auto_increment, + `id` int not null auto_increment, `product` int not null, `customer` int not null, `count` int not null default 1, - primary key (`ID`), + primary key (`id`), constraint `cart_product_fk` foreign key (`product`) - references webs.product (`ID`) + references webs.product (`id`) on update cascade, constraint `cart_customer_fk` foreign key (`customer`) - references webs.customer (`ID`) + references webs.customer (`id`) on update cascade ); create table if not exists webs.promotion ( - `ID` int not null auto_increment, + `id` int not null auto_increment, `product` int not null, `count_buff` int not null default 1, `price_buff` decimal(4, 3) not null default 1.0, - primary key (`ID`), + primary key (`id`), constraint `promotion_product_fk` foreign key (`product`) - references webs.product (`ID`) + references webs.product (`id`) on update cascade ); -- cgit v1.2.3