Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE `users` (
- `username` VARCHAR(10) NOT NULL,
- `password` VARCHAR(32) NOT NULL,
- CONSTRAINT pkUsers PRIMARY KEY(`username`)
- ) ENGINE=InnoDB;
- CREATE TABLE `recipes` (
- `id` INT NOT NULL AUTO_INCREMENT,
- `name` VARCHAR(20) NOT NULL,
- CONSTRAINT pkRecipes PRIMARY KEY(`id`)
- ) ENGINE=InnoDB;
- CREATE TABLE `ingredients` (
- `id` INT NOT NULL AUTO_INCREMENT,
- `name` VARCHAR(20) NOT NULL,
- CONSTRAINT pkIngredients PRIMARY KEY(`id`)
- ) ENGINE=InnoDB;
- CREATE TABLE `userCabinet` (
- `user_id` VARCHAR(10) NOT NULL,
- `ingredient_id` INT NOT NULL,
- CONSTRAINT fkCabUser FOREIGN KEY(`user_id`) REFERENCES `users`(`username`),
- CONSTRAINT fkCabIngrdt FOREIGN KEY(`ingredient_id`) REFERENCES `ingredients`(`id`)
- ) ENGINE=InnoDB;
- CREATE TABLE `recipeComponents` (
- `recipe_id` INT NOT NULL,
- `ingredient_id` INT NOT NULL,
- CONSTRAINT fkCmpntRecipe FOREIGN KEY(`recipe_id`) REFERENCES `recipes`(`id`),
- CONSTRAINT fkCmpntIngrdt FOREIGN KEY(`ingredient_id`) REFERENCES `ingredients`(`id`)
- ) ENGINE=InnoDB;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement