aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-05-08 13:23:34 +0200
committerlonkaars <loek@pipeframe.xyz>2023-05-08 13:23:34 +0200
commit08d6281d872a8d2a496462f131cbdc860432acc0 (patch)
tree24cd0a951c4df85912d0f49d6474bd6337b64aec
parent847347fb5511f6c526e41e0e5963e6d4f3882e58 (diff)
add subcategories to database schema
-rw-r--r--db/init.sql7
1 files changed, 6 insertions, 1 deletions
diff --git a/db/init.sql b/db/init.sql
index 872d456..d84d4e9 100644
--- a/db/init.sql
+++ b/db/init.sql
@@ -3,7 +3,12 @@ create schema if not exists webs;
create table if not exists webs.category (
`ID` int not null auto_increment,
`name` varchar(45) not null,
- primary key (`ID`)
+ `parent` int null default null,
+ primary key (`ID`),
+ constraint `category_parent_fk`
+ foreign key (`parent`)
+ references webs.category (`ID`)
+ on update cascade
);
create table if not exists webs.product (