-- http://www.phpmyadmin.net
--




--
-- Database: `bust_that_nut`
--

-- --------------------------------------------------------

--
-- Table structure for table `category`
--

CREATE TABLE `category` (
  `id` int(11) NOT NULL,
  `name` varchar(50) DEFAULT NULL,
  `type` varchar(50) DEFAULT NULL,
  `subtype` varchar(50) DEFAULT NULL,
  `status` int(11) DEFAULT NULL,
  `create_date` date DEFAULT NULL,
  `update_date` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `category`
--

INSERT INTO `category` (`id`, `name`, `type`, `subtype`, `status`, `create_date`, `update_date`) VALUES
(1, 'Magniser', 'Holy', 'Moly', 1, NULL, NULL),
(2, 'Blitz', 'Inter', 'type', 1, NULL, NULL),
(4, 'sSD', 'GHJ', 'FFF', 1, NULL, NULL);

-- --------------------------------------------------------

--
-- Table structure for table `product`
--

CREATE TABLE `product` (
  `id` int(11) NOT NULL,
  `name` varchar(50) DEFAULT NULL,
  `count` int(11) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `price` double DEFAULT NULL,
  `icon` varchar(100) DEFAULT NULL,
  `create_date` date DEFAULT NULL,
  `categoryID` int(11) NOT NULL,
  `update_date` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `product`
--

INSERT INTO `product` (`id`, `name`, `count`, `user_id`, `price`, `icon`, `create_date`, `categoryID`, `update_date`) VALUES
(5, 'Brano', 10, 10, 120, 'home.png', NULL, 1, NULL),
(6, 'ABC', 2, 9, 34, '', NULL, 1, NULL),
(7, 'Eagle', 34, 11, 567, '', NULL, 1, NULL),
(8, 'Elephant', 8, 3, 45, 'cards-to-sell.png', NULL, 1, NULL),
(9, 'MobilApp', 1, 12, 500, 'cards-to-sell.png', NULL, 1, NULL),
(11, 'Elephant', 4, 19, NULL, 'cards-to-sell.png', '0000-00-00', 1, NULL),
(12, 'MobilApp', 2, 19, NULL, 'cards-to-sell.png', '0000-00-00', 1, NULL),
(13, 'Cell', 1, 3, 123, 'cards-to-sell.png', NULL, 1, NULL),
(14, 'tth', 1, 18, 12, 'cards-to-sell.png', NULL, 1, NULL),
(15, 'yuo', 1, 3, 23, '', NULL, 1, NULL);

-- --------------------------------------------------------

--
-- Table structure for table `products_buy_logs`
--

CREATE TABLE `products_buy_logs` (
  `id` int(11) NOT NULL,
  `product_forsale_id` int(11) NOT NULL,
  `total_products` int(11) DEFAULT NULL,
  `per_product_price` float DEFAULT NULL,
  `buyer_user_id` int(11) DEFAULT NULL,
  `seller_user_id` int(11) DEFAULT NULL,
  `create_date` date DEFAULT NULL,
  `update_date` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `products_buy_logs`
--

INSERT INTO `products_buy_logs` (`id`, `product_forsale_id`, `total_products`, `per_product_price`, `buyer_user_id`, `seller_user_id`, `create_date`, `update_date`) VALUES
(1, 1, 2, 24, 19, 3, '0000-00-00', NULL),
(2, 2, 2, 24, 19, 12, '0000-00-00', NULL),
(3, 1, 2, 24, 19, 3, '0000-00-00', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `products_forsale`
--

CREATE TABLE `products_forsale` (
  `id` int(11) NOT NULL,
  `product_id` int(11) NOT NULL,
  `per_product_price` float DEFAULT NULL,
  `active_till` int(11) DEFAULT NULL,
  `total_products_for_sale` int(11) DEFAULT NULL,
  `create_date` date DEFAULT NULL,
  `update_date` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `products_forsale`
--

INSERT INTO `products_forsale` (`id`, `product_id`, `per_product_price`, `active_till`, `total_products_for_sale`, `create_date`, `update_date`) VALUES
(1, 8, 24, 1477034807, 0, NULL, NULL),
(2, 9, 24, 1787909221, 1, NULL, NULL),
(3, 11, 1, 1787909783, 1, NULL, NULL),
(4, 12, 1, 1476941866, 0, NULL, NULL),
(5, 5, 10, 1479523286, 2, NULL, NULL);

--
-- Indexes for dumped tables
--

--
-- Indexes for table `category`
--
ALTER TABLE `category`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `product`
--
ALTER TABLE `product`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_category_id` (`categoryID`),
  ADD KEY `fk_user_id` (`user_id`);

--
-- Indexes for table `products_buy_logs`
--
ALTER TABLE `products_buy_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_product_forsale_id` (`product_forsale_id`),
  ADD KEY `fk_buyer_id` (`buyer_user_id`),
  ADD KEY `fk_seller_id` (`seller_user_id`);

--
-- Indexes for table `products_forsale`
--
ALTER TABLE `products_forsale`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_product_id` (`product_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `category`
--
ALTER TABLE `category`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `product`
--
ALTER TABLE `product`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
--
-- AUTO_INCREMENT for table `products_buy_logs`
--
ALTER TABLE `products_buy_logs`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `products_forsale`
--
ALTER TABLE `products_forsale`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- Constraints for dumped tables
--

--
-- Constraints for table `product`
--
ALTER TABLE `product`
  ADD CONSTRAINT `fk_category_id` FOREIGN KEY (`categoryID`) REFERENCES `category` (`id`),
  ADD CONSTRAINT `fk_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);

--
-- Constraints for table `products_buy_logs`
--
ALTER TABLE `products_buy_logs`
  ADD CONSTRAINT `fk_buyer_id` FOREIGN KEY (`buyer_user_id`) REFERENCES `user` (`id`),
  ADD CONSTRAINT `fk_product_forsale_id` FOREIGN KEY (`product_forsale_id`) REFERENCES `products_forsale` (`id`),
  ADD CONSTRAINT `fk_seller_id` FOREIGN KEY (`seller_user_id`) REFERENCES `user` (`id`);

--
-- Constraints for table `products_forsale`
--
ALTER TABLE `products_forsale`
  ADD CONSTRAINT `fk_product_id` FOREIGN KEY (`product_id`) REFERENCES `product` (`id`);

