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




--
-- Database: `auction_house`
--

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

--
-- 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);

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

--
-- 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
(20, 'Brano', 119, 3, 131.2, 'F5_tornado_Elie_Manitoba_2007.jpg', '2016-08-16', 1, NULL),
(21, 'Somin', 38, 3, 41, 'F5_tornado_Elie_Manitoba_2007.jpg', '2016-08-20', 2, NULL),
(22, 'Simantha', 1, 3, 191, 'F5_tornado_Elie_Manitoba_2007.jpg', '2016-08-24', 1, NULL),
(24, 'Broll', 20, 3, 1414, 'F5_tornado_Elie_Manitoba_2007.jpg', '2016-08-26', 1, NULL),
(25, 'Nirvana', 51, 3, 53, 'F5_tornado_Elie_Manitoba_2007.jpg', '2016-08-25', 1, NULL),
(27, 'Dazzle', 43, 3, 65, 'F5_tornado_Elie_Manitoba_2007.jpg', '2016-08-18', 1, NULL),
(30, 'Brano', 8, 3, 25, 'F5_tornado_Elie_Manitoba_2007.jpg', '2016-08-22', 2, NULL),
(31, 'Broll', 2, 9, 23.5, 'F5_tornado_Elie_Manitoba_2007.jpg', '0000-00-00', 1, NULL),
(32, 'Somin', 2, 9, 16, 'F5_tornado_Elie_Manitoba_2007.jpg', '0000-00-00', 2, NULL),
(33, 'Simantha', 4, 9, NULL, 'F5_tornado_Elie_Manitoba_2007.jpg', '0000-00-00', 1, NULL),
(34, 'Somin', 0, 15, NULL, 'F5_tornado_Elie_Manitoba_2007.jpg', '0000-00-00', 2, NULL),
(35, 'Broll', 0, 15, NULL, 'F5_tornado_Elie_Manitoba_2007.jpg', '0000-00-00', 1, NULL),
(36, 'Brano', 3, 15, NULL, 'F5_tornado_Elie_Manitoba_2007.jpg', '0000-00-00', 1, NULL),
(37, 'Dom', 67, NULL, 30, '', NULL, 1, NULL),
(38, 'Dom', 67, NULL, 30, '', NULL, 1, NULL),
(39, 'Blok', 40, NULL, 23, '', NULL, 2, NULL),
(41, 'Test', 50, 3, 20, '', NULL, 1, NULL),
(42, 'Test', 50, NULL, 20, '', NULL, 2, 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` int(11) 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, 1, 131.2, 9, 3, 1473240672, NULL),
(2, 2, 10, 16, 3, 9, 1473240672, NULL),
(3, 1, 1, 131.2, 9, 3, 1473240672, NULL),
(4, 3, 5, 25, 3, 9, 1473240672, NULL),
(5, 3, 55, 25, 3, 9, 1473240672, NULL),
(6, 4, 1, 191, 9, 3, 1473240672, NULL),
(7, 1, 5, 131.2, 9, 3, 1473240672, NULL),
(8, 2, 1, 16, 3, 9, 1473240672, NULL),
(9, 1, 5, 131.2, 9, 3, 1473240672, NULL),
(10, 6, 1, 41, 9, 3, 1473240672, NULL),
(11, 6, 1, 41, 3, 3, 1473240672, NULL),
(12, 9, 3, 23.5, 3, 9, 1473272142, NULL),
(13, 2, 1, 16, 3, 9, 1475054390, NULL),
(14, 3, 1, 25, 3, 9, 1475054481, NULL),
(15, 3, 1, 25, 3, 9, 1475054482, NULL),
(16, 1, 1, 131.2, 3, 3, 1475054516, NULL),
(17, 1, 1, 131.2, 3, 3, 1475054520, NULL),
(18, 1, 2, 131.2, 3, 3, 1475054541, NULL),
(19, 6, 1, 41, 3, 3, 1475054581, NULL),
(20, 6, 1, 41, 3, 3, 1475054584, NULL),
(21, 11, 1, 1, 3, 9, 1475054611, NULL),
(22, 8, 43, 65, 3, 3, 1475055680, NULL),
(23, 6, 1, 41, 15, 3, 1475085583, NULL),
(24, 6, 1, 41, 15, 3, 1475085586, NULL),
(25, 10, 1, 50, 15, 3, 1475085780, NULL),
(26, 1, 1, 131.2, 15, 3, 1475085995, NULL),
(27, 1, 1, 131.2, 15, 3, 1475085996, NULL),
(28, 1, 1, 131.2, 15, 3, 1475085998, NULL),
(29, 1, 1, 131.2, 15, 3, 1475085999, NULL),
(30, 12, 1, 0, 3, 15, 1475086195, NULL),
(31, 13, 1, 0, 3, 15, 1475086217, NULL),
(32, 7, 1, 53, 3, 3, 1475264908, NULL),
(33, 14, 1, 0, 3, 15, 1475265206, NULL),
(34, 14, 1, 0, 3, 15, 1475265211, NULL),
(35, 1, 1, 131.2, 15, 3, 1475268214, NULL),
(36, 13, 1, 0, 3, 15, 1475270268, NULL),
(37, 7, 1, 53, 3, 3, 1475273019, NULL),
(38, 7, 1, 53, 3, 3, 1475273022, NULL),
(39, 7, 49, 53, 3, 3, 1475273025, NULL),
(40, 1, 1, 131.2, 3, 3, 1475273270, NULL),
(41, 1, 1, 131.2, 3, 3, 1475273271, NULL),
(42, 1, 1, 131.2, 3, 3, 1475273274, NULL),
(43, 1, 10, 131.2, 3, 3, 1475273286, NULL),
(44, 9, 10, 23.5, 3, 9, 1475758770, NULL),
(45, 9, 6, 23.5, 3, 9, 1475758786, 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, 20, 131.2, 1786798627, 118, NULL, NULL),
(2, 32, 16, 1784268015, 0, NULL, NULL),
(3, 30, 25, 1784267855, 0, NULL, NULL),
(4, 22, 191, 1784067886, 0, NULL, NULL),
(6, 21, 41, 1786304267, 36, NULL, NULL),
(7, 25, 53, 1786313003, 0, NULL, NULL),
(8, 27, 65, 1786097056, 43, NULL, NULL),
(9, 31, 23.5, 1786798735, 2, NULL, NULL),
(10, 24, 50, 1786096924, 3, NULL, NULL),
(11, 33, 1, 1784273468, 0, NULL, NULL),
(12, 35, 0, 1786125882, 0, NULL, NULL),
(13, 34, 0, 1786125940, 0, NULL, NULL),
(14, 36, 0, 1786126290, 0, NULL, NULL),
(15, 41, 20, 1786529259, 40, 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=3;
--
-- AUTO_INCREMENT for table `product`
--
ALTER TABLE `product`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=43;
--
-- AUTO_INCREMENT for table `products_buy_logs`
--
ALTER TABLE `products_buy_logs`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=46;
--
-- AUTO_INCREMENT for table `products_forsale`
--
ALTER TABLE `products_forsale`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
--
-- 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`);

