diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/data.sql | 15 | ||||
-rw-r--r-- | db/init.sql | 12 | ||||
-rw-r--r-- | db/reset.sql | 2 |
3 files changed, 16 insertions, 13 deletions
diff --git a/db/data.sql b/db/data.sql index d02fa61..7254a90 100644 --- a/db/data.sql +++ b/db/data.sql @@ -19,14 +19,15 @@ update webs.product set description = "<ul><li>lekker sappig</li><li>zonder BTW< update webs.product set description = "<ul><li>snel bruin</li><li>zonder BTW</li></ul>" where id = 2; update webs.product set description = "<ul><li>kurkdroog</li><li>zonder BTW</li></ul>" where id = 3; -insert into webs.customer (`name`) values - ("loek"), - ("bert"), - ("niels"), - ("joshua"), - ("willem"); +insert into webs.user (`name`, `hash`) values + ("loek", "$2b$12$HuKuEfTuD081gi8/VWtAl.WwpfD6MM6fAekxng22wwquoIyiK1zGC"), -- gert123 + ("bert", "$2b$12$s8ag3gsHThqIZUzqzfcX8O.v4mXfMAeu2G4X51nQOesmVPuXl0hse"), -- win32 + ("niels", "$2b$12$4JDIzpWAQpz3Iv9IdiwNzOoeSx0IPnDiO6EMVOz6knW8JGhm60wPO"), -- bsod + ("joshua", "$2b$12$CrBgZljVGYHZt.xF.HWziOgwD9qL7jMxfHh6.fXxO55rbwtoRXYM6"), -- darwin + ("willem", "$2b$12$vCDpn5fnGBL7dv3Ty1cgZegDKOguoRIgHNrUFYOCWoensgI4HnJde"); -- biege +update webs.user set `privileges` = 1073741824 where `name` = "loek"; -insert into webs.cart (`product`, `customer`) values +insert into webs.cart (`product`, `user`) values (4, 1), (5, 1), (6, 1), diff --git a/db/init.sql b/db/init.sql index 4be1768..b7b3310 100644 --- a/db/init.sql +++ b/db/init.sql @@ -25,25 +25,27 @@ create table if not exists webs.product ( on update cascade ); -create table if not exists webs.customer ( +create table if not exists webs.user ( `id` int not null auto_increment, `name` varchar(45) not null, + `hash` binary(64) not null, + `privileges` int not null default 1, primary key (`id`) ); create table if not exists webs.cart ( `id` int not null auto_increment, `product` int not null, - `customer` int not null, + `user` int not null, `count` int not null default 1, primary key (`id`), constraint `cart_product_fk` foreign key (`product`) references webs.product (`id`) on update cascade, - constraint `cart_customer_fk` - foreign key (`customer`) - references webs.customer (`id`) + constraint `cart_user_fk` + foreign key (`user`) + references webs.user (`id`) on update cascade ); diff --git a/db/reset.sql b/db/reset.sql index 5338395..7036613 100644 --- a/db/reset.sql +++ b/db/reset.sql @@ -1,6 +1,6 @@ drop schema if exists webs; drop table if exists webs.product; -drop table if exists webs.customer; +drop table if exists webs.user; drop table if exists webs.cart; drop table if exists webs.promotion; drop table if exists webs.category; |