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

START TRANSACTION;



--
-- Database: `scac8254_coba`
--

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

--
-- Table structure for table `admins`
--

CREATE TABLE `admins` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `username` varchar(100) NOT NULL,
  `email` varchar(150) NOT NULL,
  `password` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `admins`
--

INSERT INTO `admins` (`id`, `name`, `username`, `email`, `password`, `created_at`) VALUES
(2, 'ceirgo', 'scardflasher', 'setevensugiarto90@gmail.com', '$2y$10$1Cr27fsLeFZDAb8EpGKsBee7hsilOqDY6jcuvgW9akBVekBEvntiq', '2026-02-15 13:27:34');

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

--
-- 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 `resellers`
--

CREATE TABLE `resellers` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `email` varchar(150) NOT NULL,
  `username` varchar(100) DEFAULT NULL,
  `password` varchar(255) NOT NULL,
  `status` enum('active','suspended') DEFAULT 'active',
  `domain` varchar(200) DEFAULT NULL,
  `subdomain` varchar(100) DEFAULT NULL,
  `web_title` varchar(150) DEFAULT 'Katalog Saya',
  `logo` varchar(255) DEFAULT NULL,
  `favicon` varchar(255) DEFAULT NULL,
  `primary_color` varchar(20) DEFAULT '#6a85f1',
  `secondary_color` varchar(20) DEFAULT '#c86dd7',
  `price_type` enum('percent','nominal') DEFAULT 'percent',
  `price_value` int(11) DEFAULT 0,
  `total_visit` int(11) DEFAULT 0,
  `created_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `resellers`
--

INSERT INTO `resellers` (`id`, `name`, `email`, `username`, `password`, `status`, `domain`, `subdomain`, `web_title`, `logo`, `favicon`, `primary_color`, `secondary_color`, `price_type`, `price_value`, `total_visit`, `created_at`) VALUES
(1, 'youth', 'slot96122@gmail.com', 'scardflasher', '$2y$10$spgm.PkqajDetqvfY.Z72.04IW1PLveZsdc0jKZtfQ.sIb7dH5kWC', 'active', '', 'ok', 'youth', NULL, NULL, '#6a85f1', '#c86dd7', 'percent', 0, 37, '2026-02-15 13:45:57');

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

--
-- 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 dumped tables
--

--
-- Indexes for table `admins`
--
ALTER TABLE `admins`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`),
  ADD UNIQUE KEY `email` (`email`);

--
-- 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 `resellers`
--
ALTER TABLE `resellers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `email` (`email`),
  ADD UNIQUE KEY `username` (`username`),
  ADD UNIQUE KEY `domain` (`domain`),
  ADD UNIQUE KEY `subdomain` (`subdomain`);

--
-- 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 dumped tables
--

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

--
-- 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 `resellers`
--
ALTER TABLE `resellers`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

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

