text: -- phpMyAdmin SQL Dump
  -- version 4.9.1
  -- https://www.phpmyadmin.net/
  --
  -- Host: 127.0.0.1
  -- Generation Time: Nov 18, 2019 at 05:39 PM
  -- Server version: 10.4.8-MariaDB
  -- PHP Version: 7.3.10
  
  SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
  SET AUTOCOMMIT = 0;
  START TRANSACTION;
  SET time_zone = "+00:00";
  
  
  /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  /*!40101 SET NAMES utf8mb4 */;
  
  --
  -- Database: `pour`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `cart`
  --
  
  CREATE TABLE `cart` (
    `user_id` int(11) NOT NULL,
    `product_id` int(11) NOT NULL,
    `quantity` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `cart`
  --
  
  INSERT INTO `cart` (`user_id`, `product_id`, `quantity`) VALUES
  (1, 1, 2),
  (3, 2, 1);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `has_ingredients`
  --
  
  CREATE TABLE `has_ingredients` (
    `product_id` int(11) NOT NULL,
    `recipe_id` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `has_ingredients`
  --
  
  INSERT INTO `has_ingredients` (`product_id`, `recipe_id`) VALUES
  (1, 1),
  (2, 1),
  (1, 3),
  (3, 2);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `product`
  --
  
  CREATE TABLE `product` (
    `product_id` int(11) NOT NULL,
    `product_title` varchar(35) NOT NULL,
    `product_price` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `product`
  --
  
  INSERT INTO `product` (`product_id`, `product_title`, `product_price`) VALUES
  (1, 'Flour', 13),
  (2, 'Chicken', 20),
  (3, 'Fish', 24);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `rate`
  --
  
  CREATE TABLE `rate` (
    `user_id` int(11) NOT NULL,
    `recipe_id` int(11) NOT NULL,
    `rate` double NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `rate`
  --
  
  INSERT INTO `rate` (`user_id`, `recipe_id`, `rate`) VALUES
  (3, 1, 3),
  (1, 1, 5),
  (3, 2, 2),
  (1, 3, 5);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `recipe`
  --
  
  CREATE TABLE `recipe` (
    `recipe_id` int(6) NOT NULL,
    `title` varchar(360) NOT NULL,
    `Type` varchar(40) NOT NULL,
    `date` date NOT NULL,
    `photo` longblob DEFAULT NULL,
    `description` text NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `recipe`
  --
  
  INSERT INTO `recipe` (`recipe_id`, `title`, `Type`, `date`, `photo`, `description`) VALUES
  (1, 'Crispy Chicken', 'dinner', '2019-11-17', NULL, 'My new recipe'),
  (2, 'Fried Fish', 'dinner', '2019-11-17', NULL, 'Delicious recipe '),
  (3, 'Potato Widges', 'side dish', '2019-11-17', NULL, 'Yummy');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `recipe_connect`
  --
  
  CREATE TABLE `recipe_connect` (
    `user_id` int(11) NOT NULL,
    `recipe_id` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `recipe_connect`
  --
  
  INSERT INTO `recipe_connect` (`user_id`, `recipe_id`) VALUES
  (2, 1),
  (3, 2),
  (2, 3);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `recipe_folder`
  --
  
  CREATE TABLE `recipe_folder` (
    `user_id` int(11) NOT NULL,
    `recipe_id` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `recipe_folder`
  --
  
  INSERT INTO `recipe_folder` (`user_id`, `recipe_id`) VALUES
  (3, 1),
  (3, 2),
  (1, 3);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `user`
  --
  
  CREATE TABLE `user` (
    `user_id` int(6) NOT NULL,
    `chief` tinyint(1) NOT NULL,
    `username` text NOT NULL,
    `email` varchar(320) NOT NULL,
    `password` varchar(60) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `user`
  --
  
  INSERT INTO `user` (`user_id`, `chief`, `username`, `email`, `password`) VALUES
  (1, 1, 'Hamad', 'hamad@gmail.com', 'hamad1'),
  (2, 0, 'Arwa', 'Arwa@outlook.com', 'arwa1'),
  (3, 1, 'Ali', 'Ali@gmail.com', 'al1');
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `cart`
  --
  ALTER TABLE `cart`
    ADD PRIMARY KEY (`user_id`,`product_id`),
    ADD KEY `product_id` (`product_id`);
  
  --
  -- Indexes for table `has_ingredients`
  --
  ALTER TABLE `has_ingredients`
    ADD KEY `product_id` (`product_id`),
    ADD KEY `recipe_id` (`recipe_id`);
  
  --
  -- Indexes for table `product`
  --
  ALTER TABLE `product`
    ADD PRIMARY KEY (`product_id`);
  
  --
  -- Indexes for table `rate`
  --
  ALTER TABLE `rate`
    ADD KEY `recipe_id` (`recipe_id`),
    ADD KEY `user_id` (`user_id`);
  
  --
  -- Indexes for table `recipe`
  --
  ALTER TABLE `recipe`
    ADD PRIMARY KEY (`recipe_id`);
  
  --
  -- Indexes for table `recipe_connect`
  --
  ALTER TABLE `recipe_connect`
    ADD KEY `recipe_id` (`recipe_id`),
    ADD KEY `user_id` (`user_id`);
  
  --
  -- Indexes for table `recipe_folder`
  --
  ALTER TABLE `recipe_folder`
    ADD KEY `user_id` (`user_id`),
    ADD KEY `recipe_id` (`recipe_id`);
  
  --
  -- Indexes for table `user`
  --
  ALTER TABLE `user`
    ADD PRIMARY KEY (`user_id`),
    ADD UNIQUE KEY `email` (`email`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  
  --
  -- AUTO_INCREMENT for table `product`
  --
  ALTER TABLE `product`
    MODIFY `product_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
  
  --
  -- AUTO_INCREMENT for table `recipe`
  --
  ALTER TABLE `recipe`
    MODIFY `recipe_id` int(6) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
  
  --
  -- AUTO_INCREMENT for table `user`
  --
  ALTER TABLE `user`
    MODIFY `user_id` int(6) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
  
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `cart`
  --
  ALTER TABLE `cart`
    ADD CONSTRAINT `cart_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `product` (`product_id`),
    ADD CONSTRAINT `cart_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`);
  
  --
  -- Constraints for table `has_ingredients`
  --
  ALTER TABLE `has_ingredients`
    ADD CONSTRAINT `has_ingredients_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `product` (`product_id`),
    ADD CONSTRAINT `has_ingredients_ibfk_2` FOREIGN KEY (`recipe_id`) REFERENCES `recipe` (`recipe_id`);
  
  --
  -- Constraints for table `rate`
  --
  ALTER TABLE `rate`
    ADD CONSTRAINT `rate_ibfk_1` FOREIGN KEY (`recipe_id`) REFERENCES `recipe` (`recipe_id`),
    ADD CONSTRAINT `rate_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`);
  
  --
  -- Constraints for table `recipe_connect`
  --
  ALTER TABLE `recipe_connect`
    ADD CONSTRAINT `recipe_connect_ibfk_1` FOREIGN KEY (`recipe_id`) REFERENCES `recipe` (`recipe_id`),
    ADD CONSTRAINT `recipe_connect_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`);
  
  --
  -- Constraints for table `recipe_folder`
  --
  ALTER TABLE `recipe_folder`
    ADD CONSTRAINT `recipe_folder_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`),
    ADD CONSTRAINT `recipe_folder_ibfk_2` FOREIGN KEY (`recipe_id`) REFERENCES `recipe` (`recipe_id`);
  COMMIT;
  
  /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  