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

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

--
-- Table structure for table `user`
--

CREATE TABLE `user` (
  `id` int(11) NOT NULL,
  `username` varchar(50) DEFAULT NULL,
  `password` varchar(50) DEFAULT NULL,
  `email` varchar(50) DEFAULT NULL,
  `full_name` varchar(50) DEFAULT NULL,
  `accesstoken_android` varchar(100) DEFAULT NULL,
  `totalBalance` double DEFAULT NULL,
  `Is_available` int(11) DEFAULT NULL,
  `accesstoken_ios` varchar(100) DEFAULT NULL,
  `platform_type` int(11) DEFAULT NULL,
  `create_date` date DEFAULT NULL,
  `update_date` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `user`
--

INSERT INTO `user` (`id`, `username`, `password`, `email`, `full_name`, `accesstoken_android`, `totalBalance`, `Is_available`, `accesstoken_ios`, `platform_type`, `create_date`, `update_date`) VALUES
(3, 'admin', '123', 'sajawals93@gmail.com', '123', NULL, 1121.34, 1, NULL, NULL, NULL, NULL),
(9, 'User1', '123', 'user@gmail.com', NULL, NULL, 11610, 1, NULL, NULL, NULL, NULL),
(10, 'John', 'abc123', 'John@gmail.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(11, 'Brok', 'abc123', 'John@gmail.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(12, 'Yasin', '456', 'yasin@gmail.com', NULL, NULL, 48, 1, NULL, NULL, NULL, NULL),
(13, 'Zohaib', '456', 'zohaib83@ymail.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(14, 'Hammad', '123', 'h@gmail.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(16, 'Jamil', '7898', 'jamil@GMAIL.COM', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(18, 'Uzma', '123', 'uzma@gmail.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(19, 'Hassan', '123', 'zohaib.khan@geniteam.com', NULL, NULL, 9952, 1, NULL, NULL, NULL, NULL),
(20, 'Dfsf', '456', 'g', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(21, 'Guest', 'tester', 'guest@test.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(22, 'Ggd', 'hdgvd', 'hh', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(23, 'Dfff', '1234', 'd@gmail.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(24, 'Zohaibbbb', '345', 'g@gmail.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(25, 'Asadfg', '', 'khan@gmail.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(26, 'Gjddjfjhdfj', 'asd', 'khan@ymail.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(27, 'Zohaib Khan', 'uyuyt', 'khan@gmail.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(28, 'Zhddhd', '1', 'z@gmail.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(29, 'Dffff', '    ', 'z@gmail.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(30, 'Sohaib', 'mirza', 'Mirzasohaib60@gmail.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(31, 'Moeen', '123', 'Moeen.ahmad@geniteam.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(32, 'Jawad Akram', 'jawad123', 'jawad@gmail.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(33, 'Bust', '1234', 'z@gmail.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(34, 'Asd', '1234', 'A@ymail.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(35, 'Zombie', '1234', 'z@gmail.com', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL),
(36, 'James', '1234', 'John@gmail.com', NULL, NULL, 0, 1, NULL, NULL, 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`);

--
-- Indexes for table `user`
--
ALTER TABLE `user`
  ADD PRIMARY KEY (`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;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=37;
--
-- 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`);

