-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `pqomir_tmseller`
--

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

--
-- Table structure for table `orders`
--

CREATE TABLE `orders` (
  `id` int(11) NOT NULL,
  `Refid` varchar(100) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL COMMENT 'کد پیگیری',
  `status` varchar(255) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
  `price` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `orders`
--

INSERT INTO `orders` (`id`, `Refid`, `status`, `price`, `user_id`, `date`) VALUES
(1, '', 'cancelled', 40000, 3, '2016-09-22 11:36:23'),
(2, '', 'cancelled', 69000, 4, '2017-01-01 12:01:06'),
(3, '', 'cancelled', 69000, 5, '2017-02-27 12:24:43'),
(4, '', 'success', 69000, 5, '2017-02-27 12:26:52'),
(5, '', 'success', 69000, 5, '2017-04-15 01:48:32'),
(6, '', 'success', 29000, 6, '2017-12-24 04:14:26'),
(7, '', 'cancelled', 69000, 6, '2017-12-24 04:15:33');

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

--
-- Table structure for table `orders_products`
--

CREATE TABLE `orders_products` (
  `order_id` int(11) NOT NULL,
  `product_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `orders_products`
--

INSERT INTO `orders_products` (`order_id`, `product_id`) VALUES
(1, 12),
(2, 12),
(2, 11),
(3, 12),
(3, 11),
(4, 12),
(4, 11),
(5, 12),
(5, 11),
(6, 11),
(7, 11),
(7, 12);

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

--
-- Table structure for table `products`
--

CREATE TABLE `products` (
  `id` int(11) NOT NULL,
  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
  `description` text CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
  `price` int(11) NOT NULL,
  `image` varchar(255) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
  `hit` int(11) NOT NULL,
  `designer` varchar(255) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
  `responsive` tinyint(4) NOT NULL,
  `year` int(11) NOT NULL,
  `positions` int(11) NOT NULL,
  `menutype` varchar(255) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
  `link` varchar(255) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `products`
--

INSERT INTO `products` (`id`, `name`, `description`, `price`, `image`, `hit`, `designer`, `responsive`, `year`, `positions`, `menutype`, `link`, `date`) VALUES
(1, 'یوکینگ', 'قالب یوکینگ', 30000, './images/sj-uking.png', 0, 'اسمارت اد آنز', 1, 2016, 28, 'مگا منو', './files/sj-uking.zip', '2015-09-03 09:14:52'),
(2, 'رویداد 2', 'قالب رویداد 2', 25000, './images/ja-event-ii.png', 16, 'جوملا آرت', 1, 2016, 15, 'مگا منو', './files/ja-event-ii.zip', '2015-09-03 09:14:52'),
(3, 'لیکا', 'قالب لیکا', 33000, './images/yoo-lykka.png', 0, 'یوتم', 1, 2016, 15, 'مگا منو', './files/yoo-lykka.zip', '2015-09-03 09:14:52'),
(4, 'آگازا', 'قالب آگازا', 32000, './images/sj-agaza.png', 0, 'اسمارت اد آنز', 1, 2016, 25, 'مگا منو', './files/sj-agaza.zip', '2016-08-06 09:14:52'),
(5, 'ویک ماگز', 'قالب ویک ماگز', 37000, './images/sj-vicmagz.png', 1, 'اسمارت اد آنز', 1, 2016, 17, 'مگا منو', './files/sj-vicmagz.zip', '2016-08-06 09:14:52'),
(6, 'ویدا', 'قالب ویدا', 42000, './images/yoovida.png', 1, 'یوتم', 1, 2014, 36, 'مگامنو', './files/yoovida.zip', '2016-08-06 09:14:52'),
(7, 'شرکتی', 'قالب شرکتی', 38000, './images/sj-company.png', 0, 'اسمارت اد آنز', 1, 2015, 38, 'مگا منو', './files/sj-company.zip', '2016-08-06 09:14:52'),
(8, 'موج خبری', 'قالب موج خبری', 35000, './images/sj-wavenews.png', 0, 'اسمارت اد آنز', 1, 2016, 20, 'مگا منو', './files/sj-wavenews.zip', '2016-08-06 09:14:52'),
(9, 'پرتی', 'قالب پرتی', 32000, './images/sj-perty.png', 3, 'اسمارت اد آنز', 1, 2016, 28, 'مگامنو', './files/sj-perty.zip', '2016-08-06 09:14:52'),
(10, 'جستجوی خانه', 'قالب جستجوی خانه', 34000, './images/find-home.png', 5, 'وی تم', 1, 2016, 64, 'مگا منو', './files/find-home.zip', '2016-09-02 09:14:52'),
(11, 'وب هاستینگ', 'قالب وب هاستینگ', 29000, './images/ez-webhosting.png', 3, 'شیپ 5', 1, 2014, 94, 'مگا منو', './files/ez-webhosting.zip', '2016-09-02 09:14:52'),
(12, 'بهداشت و درمان', '<p>قالب بهداشت و درمان</p>', 40000, './images/sj-healthcare.png', 49, 'اسمارت اد آنز', 1, 2016, 32, 'مگا منو', './files/sj-healthcare.zip', '2016-09-03 02:50:52');

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

--
-- Table structure for table `tickets`
--

CREATE TABLE `tickets` (
  `id` int(11) NOT NULL,
  `title` varchar(255) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
  `text` text CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
  `user_id` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tickets`
--

INSERT INTO `tickets` (`id`, `title`, `text`, `user_id`, `date`) VALUES
(1, 'asdasd', '<p>asdasd</p>', 3, '2016-09-22 11:40:49'),
(2, 'خرید قالب', '<p>چرا دسترسی ندارم</p>', 5, '2017-02-27 12:29:10'),
(3, 'خراب بودن قالب', '<p>قالب خریداری شده خراب است.</p>', 5, '2017-04-15 01:46:18'),
(4, 'خرابی محصول', '<p>فایل محصول باز نمیشود.</p>', 6, '2017-12-24 04:20:03');

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

--
-- Table structure for table `tickets_replies`
--

CREATE TABLE `tickets_replies` (
  `id` int(11) NOT NULL,
  `text` text CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
  `user_id` int(11) NOT NULL,
  `ticket_id` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tickets_replies`
--

INSERT INTO `tickets_replies` (`id`, `text`, `user_id`, `ticket_id`, `date`) VALUES
(1, '<p>asdasdssad</p>', 1, 1, '2016-09-22 11:41:03'),
(2, '<p>چرا؟؟؟؟؟؟؟؟؟؟؟</p>', 5, 2, '2017-02-27 12:29:32'),
(3, '<p>خوب دیگه :-)</p>', 1, 2, '2017-02-27 12:29:56'),
(4, '<p>در حال بررسی</p>', 1, 3, '2017-04-15 01:46:46'),
(5, '<p>لطفا پاسخ دهید</p>', 6, 4, '2017-12-24 04:36:48'),
(6, '<p>بررسی می شود</p>', 1, 4, '2017-12-24 05:02:44');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `orders`
--
ALTER TABLE `orders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `orders_products`
--
ALTER TABLE `orders_products`
  ADD KEY `order_id` (`order_id`),
  ADD KEY `product_id` (`product_id`);

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

--
-- Indexes for table `tickets`
--
ALTER TABLE `tickets`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `tickets_replies`
--
ALTER TABLE `tickets_replies`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`),
  ADD KEY `ticket_id` (`ticket_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `orders`
--
ALTER TABLE `orders`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `products`
--
ALTER TABLE `products`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- AUTO_INCREMENT for table `tickets`
--
ALTER TABLE `tickets`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `tickets_replies`
--
ALTER TABLE `tickets_replies`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- Constraints for dumped tables
--

--
-- Constraints for table `orders`
--
ALTER TABLE `orders`
  ADD CONSTRAINT `orders_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `orders_products`
--
ALTER TABLE `orders_products`
  ADD CONSTRAINT `orders_products_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`),
  ADD CONSTRAINT `orders_products_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`);

--
-- Constraints for table `tickets`
--
ALTER TABLE `tickets`
  ADD CONSTRAINT `tickets_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `tickets_replies`
--
ALTER TABLE `tickets_replies`
  ADD CONSTRAINT `tickets_replies_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `tickets_replies_ibfk_2` FOREIGN KEY (`ticket_id`) REFERENCES `tickets` (`id`);
COMMIT;

