Created
April 21, 2020 14:04
-
-
Save bastienapp/b7b668d9d1663c2ad58354247cddd033 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------------------ | |
# Script MySQL. | |
#------------------------------------------------------------ | |
#------------------------------------------------------------ | |
# Table: wizard | |
#------------------------------------------------------------ | |
CREATE TABLE wizard( | |
id_wizard Int Auto_increment NOT NULL , | |
email Varchar (255) NOT NULL , | |
password Varchar (255) NOT NULL | |
,CONSTRAINT wizard_PK PRIMARY KEY (id_wizard) | |
)ENGINE=InnoDB; | |
#------------------------------------------------------------ | |
# Table: category | |
#------------------------------------------------------------ | |
CREATE TABLE category( | |
id_category Int Auto_increment NOT NULL , | |
title Varchar (255) NOT NULL | |
,CONSTRAINT category_PK PRIMARY KEY (id_category) | |
)ENGINE=InnoDB; | |
#------------------------------------------------------------ | |
# Table: potion | |
#------------------------------------------------------------ | |
CREATE TABLE potion( | |
id_potion Int Auto_increment NOT NULL , | |
name Varchar (255) NOT NULL , | |
price Float NOT NULL , | |
id_category Int NOT NULL | |
,CONSTRAINT potion_PK PRIMARY KEY (id_potion) | |
,CONSTRAINT potion_category_FK FOREIGN KEY (id_category) REFERENCES category(id_category) | |
)ENGINE=InnoDB; | |
#------------------------------------------------------------ | |
# Table: cart | |
#------------------------------------------------------------ | |
CREATE TABLE cart( | |
id_wizard Int NOT NULL , | |
id_potion Int NOT NULL , | |
quantity Int NOT NULL | |
,CONSTRAINT cart_PK PRIMARY KEY (id_wizard,id_potion) | |
,CONSTRAINT cart_wizard_FK FOREIGN KEY (id_wizard) REFERENCES wizard(id_wizard) | |
,CONSTRAINT cart_potion0_FK FOREIGN KEY (id_potion) REFERENCES potion(id_potion) | |
)ENGINE=InnoDB; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment