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

START TRANSACTION;



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

--
-- Table structure for table `categories`
--

CREATE TABLE `categories` (
  `id` int(11) NOT NULL,
  `name` varchar(150) NOT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `categories`
--

INSERT INTO `categories` (`id`, `name`, `created_at`) VALUES
(1, 'Test', '2026-02-15 13:45:00'),
(2, 'Air', '2026-02-16 01:02:02');

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

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

CREATE TABLE `products` (
  `id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  `title` varchar(200) NOT NULL,
  `image` varchar(255) DEFAULT NULL,
  `price1` int(11) DEFAULT 0,
  `price100` int(11) DEFAULT 0,
  `price300` int(11) DEFAULT 0,
  `price500` int(11) DEFAULT 0,
  `note` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

INSERT INTO `products` (`id`, `category_id`, `title`, `image`, `price1`, `price100`, `price300`, `price500`, `note`, `created_at`) VALUES
(1, 1, 'Oke', 'Test/1771203768_1000138103.jpg', 1000, 5000, 8, 0, '', '2026-02-15 13:45:20'),
(2, 1, '', 'Test/1771203680_1000138072.jpg', 868, 588, 17, 0, '', '2026-02-16 01:01:20');

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

--
-- Table structure for table `reseller_prices`
--

CREATE TABLE `reseller_prices` (
  `id` int(11) NOT NULL,
  `reseller_id` int(11) NOT NULL,
  `product_id` int(11) NOT NULL,
  `price1` int(11) DEFAULT NULL,
  `price100` int(11) DEFAULT NULL,
  `price300` int(11) DEFAULT NULL,
  `price500` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `reseller_prices`
--

INSERT INTO `reseller_prices` (`id`, `reseller_id`, `product_id`, `price1`, `price100`, `price300`, `price500`) VALUES
(1, 1, 1, 90000, 10000, 60000, 9000000);

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

--
-- Table structure for table `visit_logs`
--

CREATE TABLE `visit_logs` (
  `id` int(11) NOT NULL,
  `reseller_id` int(11) NOT NULL,
  `ip_address` varchar(50) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

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

--
-- Indexes for table `reseller_prices`
--
ALTER TABLE `reseller_prices`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_reseller_product` (`reseller_id`,`product_id`),
  ADD KEY `product_id` (`product_id`);

--
-- Indexes for table `visit_logs`
--
ALTER TABLE `visit_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `reseller_id` (`reseller_id`);

--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `products`
--
ALTER TABLE `products`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `reseller_prices`
--
ALTER TABLE `reseller_prices`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `visit_logs`
--
ALTER TABLE `visit_logs`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `products`
--
ALTER TABLE `products`
  ADD CONSTRAINT `products_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `reseller_prices`
--
ALTER TABLE `reseller_prices`
  ADD CONSTRAINT `reseller_prices_ibfk_1` FOREIGN KEY (`reseller_id`) REFERENCES `resellers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `reseller_prices_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `visit_logs`
--
ALTER TABLE `visit_logs`
  ADD CONSTRAINT `visit_logs_ibfk_1` FOREIGN KEY (`reseller_id`) REFERENCES `resellers` (`id`) ON DELETE CASCADE;
COMMIT;

