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

START TRANSACTION;



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

--
-- Table structure for table `billings`
--

CREATE TABLE `billings` (
  `billing_id` int NOT NULL,
  `domain_order_id` int NOT NULL,
  `customer_id` int NOT NULL,
  `server_order_id` int NOT NULL,
  `order_type` enum('server','domain') COLLATE utf8mb4_general_ci NOT NULL,
  `order_price` decimal(10,2) NOT NULL,
  `payment_status` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
  `date_of_transaction` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `billings`
--

INSERT INTO `billings` (`billing_id`, `domain_order_id`, `customer_id`, `server_order_id`, `order_type`, `order_price`, `payment_status`, `date_of_transaction`) VALUES
(1, 15, 7, 0, 'domain', 300.00, 'pending', NULL),
(2, 16, 7, 0, 'domain', 100.00, 'pending', NULL),
(3, 17, 7, 0, 'domain', 100.00, 'pending', NULL),
(4, 27, 7, 0, 'domain', 1000.00, 'successful', '2024-06-20'),
(5, 28, 7, 0, 'domain', 1000.00, 'successful', '2024-06-19'),
(6, 0, 7, 9, 'server', 2000.00, 'successful', '2024-06-20'),
(7, 0, 7, 10, 'server', 2000.00, 'successful', '2024-06-19'),
(8, 0, 1, 11, 'server', 2000.00, 'pending', '2024-06-20'),
(9, 0, 7, 12, 'server', 4000.00, '0', NULL);

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

--
-- Table structure for table `domain_extensions`
--

CREATE TABLE `domain_extensions` (
  `extension_id` int NOT NULL,
  `extension` varchar(10) COLLATE utf8mb4_general_ci NOT NULL,
  `price` decimal(10,2) NOT NULL,
  `renew_price` decimal(10,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `domain_extensions`
--

INSERT INTO `domain_extensions` (`extension_id`, `extension`, `price`, `renew_price`) VALUES
(2, '.com', 1000.00, 2000.00),
(3, '.gov', 100.00, 200.00),
(4, '.online', 1000.00, 2000.00),
(5, '.mod', 1220.00, 1230.00),
(6, '.online', 129.00, 999.00);

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

--
-- Table structure for table `domain_orders`
--

CREATE TABLE `domain_orders` (
  `order_id` int NOT NULL,
  `customer_id` int NOT NULL,
  `domain_name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL,
  `purchase_date` date NOT NULL,
  `validity` int NOT NULL,
  `expiry_date` date NOT NULL,
  `ordered_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `domain_price` decimal(10,2) NOT NULL,
  `renew_price` decimal(10,2) NOT NULL,
  `auto_renew` tinyint(1) DEFAULT '0',
  `registrar_lock` tinyint(1) DEFAULT '0',
  `epp_code` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `status` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
  `extension_id` varchar(255) COLLATE utf8mb4_general_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `domain_orders`
--

INSERT INTO `domain_orders` (`order_id`, `customer_id`, `domain_name`, `purchase_date`, `validity`, `expiry_date`, `ordered_at`, `domain_price`, `renew_price`, `auto_renew`, `registrar_lock`, `epp_code`, `status`, `extension_id`) VALUES
(24, 7, 'manoharam.com', '2024-06-19', 365, '2025-06-19', '2024-06-19 16:06:07', 1000.00, 2000.00, 1, 0, NULL, 'pending', '2'),
(25, 7, 'manoharam.com', '2024-06-19', 365, '2025-06-19', '2024-06-19 16:06:29', 1000.00, 2000.00, 1, 0, NULL, 'pending', '2'),
(26, 7, 'manoharam.com', '2024-06-19', 365, '2025-06-19', '2024-06-19 16:07:02', 1000.00, 2000.00, 1, 0, NULL, 'pending', '2'),
(27, 7, 'manoharam.com', '2024-06-19', 365, '2025-06-19', '2024-06-19 16:08:20', 1000.00, 2000.00, 1, 0, NULL, 'active', '2'),
(28, 7, 'manoharam.com', '2024-06-19', 365, '2025-06-19', '2024-06-19 16:10:30', 1000.00, 2000.00, 1, 0, NULL, 'active', '2');

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

--
-- Table structure for table `nameservers`
--

CREATE TABLE `nameservers` (
  `nameserver_id` int NOT NULL,
  `domain_name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL,
  `nameserver1` varchar(255) COLLATE utf8mb4_general_ci NOT NULL,
  `nameserver2` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `nameserver3` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `nameserver4` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `domain_order_id` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `nameservers`
--

INSERT INTO `nameservers` (`nameserver_id`, `domain_name`, `nameserver1`, `nameserver2`, `nameserver3`, `nameserver4`, `domain_order_id`) VALUES
(2, 'manoharamdecor', 'abc.com', 'xyz.com', 'bcd.com', 'xid.org', 5),
(3, 'theperfectkkc.com', 'ns1.hostature.com', 'ns2.hostature.com', '', '', 13);

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

--
-- Table structure for table `server_orders`
--

CREATE TABLE `server_orders` (
  `order_id` int NOT NULL,
  `customer_id` int NOT NULL,
  `server_plan_id` int NOT NULL,
  `domain_name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL,
  `price` decimal(10,2) NOT NULL,
  `status` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
  `validity` int NOT NULL,
  `ordered_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `expires_on` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `server_orders`
--

INSERT INTO `server_orders` (`order_id`, `customer_id`, `server_plan_id`, `domain_name`, `price`, `status`, `validity`, `ordered_at`, `expires_on`) VALUES
(5, 7, 4, 'manoharamdecor', 6000.00, 'active', 6, '2024-06-18 19:11:56', '2024-12-19'),
(6, 7, 3, 'manoharam.com', 2000.00, 'pending', 3, '2024-06-19 18:25:52', '2024-09-19'),
(7, 7, 3, 'manoharam.com', 2000.00, 'pending', 3, '2024-06-19 18:26:15', '2024-09-19'),
(8, 7, 3, 'manoharam.com', 2000.00, 'pending', 3, '2024-06-19 18:26:43', '2024-09-19'),
(9, 7, 3, 'manoharam.com', 2000.00, 'active', 3, '2024-06-19 18:26:56', '2024-09-19'),
(10, 7, 3, 'manoharam.com', 2000.00, 'pending', 3, '2024-06-19 18:27:55', '2024-09-19'),
(11, 1, 3, 'happyminds.com', 2000.00, 'pending', 3, '2024-06-20 10:13:56', '2024-09-20'),
(12, 7, 4, 'jj', 4000.00, 'active', 3, '2024-06-20 10:40:15', '2024-09-20'),
(13, 8, 5, 'theperfectkkc.com', 2499.00, 'active', 12, '2024-06-21 09:16:35', '2025-06-21');

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

--
-- Table structure for table `server_plans`
--

CREATE TABLE `server_plans` (
  `plan_id` int NOT NULL,
  `plan_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL,
  `plan_description` text COLLATE utf8mb4_general_ci,
  `monthly_price` decimal(10,2) NOT NULL,
  `monthly_renew_price` decimal(10,2) NOT NULL,
  `quarterly_price` decimal(10,2) NOT NULL,
  `quarterly_renew_price` decimal(10,2) NOT NULL,
  `semi_annual_price` decimal(10,2) NOT NULL,
  `semi_annual_renew_price` decimal(10,2) NOT NULL,
  `annual_price` decimal(10,2) NOT NULL,
  `annual_renew_price` decimal(10,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `server_plans`
--

INSERT INTO `server_plans` (`plan_id`, `plan_name`, `plan_description`, `monthly_price`, `monthly_renew_price`, `quarterly_price`, `quarterly_renew_price`, `semi_annual_price`, `semi_annual_renew_price`, `annual_price`, `annual_renew_price`) VALUES
(3, 'Bronze Plan', 'Bronze plan includes various services like web hosting, domain hosting etc.', 1000.00, 1200.00, 2000.00, 2200.00, 5000.00, 5200.00, 10000.00, 12000.00),
(4, 'Silver Plan', 'silver plan is the bonanze offer', 2000.00, 3000.00, 4000.00, 5000.00, 6000.00, 7000.00, 8000.00, 9000.00),
(5, 'Business Growth Basic', '1 Website\r\n10 GB Nvme SSD\r\nBandwidth (Unlimited)\r\nEmail Accounts (Unlimited)\r\nDatabase (Unlimited)\r\nSubdomains (Unlimited)\r\nUnlimited FTP Accounts\r\nFree SSL Certificates', 249.00, 249.00, 699.00, 699.00, 1449.00, 1449.00, 2499.00, 2499.00);

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

--
-- Table structure for table `support_tickets`
--

CREATE TABLE `support_tickets` (
  `ticket_id` int NOT NULL,
  `user_id` int NOT NULL,
  `subject` varchar(255) COLLATE utf8mb4_general_ci NOT NULL,
  `message` text COLLATE utf8mb4_general_ci NOT NULL,
  `status` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `support_tickets`
--

INSERT INTO `support_tickets` (`ticket_id`, `user_id`, `subject`, `message`, `status`, `created_at`) VALUES
(1, 7, 'hello', 'its me', 'Open', '2024-06-20 10:05:37'),
(2, 8, 'I need EPP code for same', 'I need EPP code for same', 'Open', '2024-06-21 09:24:06');

--
-- Indexes for table `billings`
--
ALTER TABLE `billings`
  ADD PRIMARY KEY (`billing_id`);

--
-- Indexes for table `domain_extensions`
--
ALTER TABLE `domain_extensions`
  ADD PRIMARY KEY (`extension_id`);

--
-- Indexes for table `domain_orders`
--
ALTER TABLE `domain_orders`
  ADD PRIMARY KEY (`order_id`),
  ADD KEY `customer_id` (`customer_id`);

--
-- Indexes for table `nameservers`
--
ALTER TABLE `nameservers`
  ADD PRIMARY KEY (`nameserver_id`),
  ADD KEY `fk_domain_order_id_new` (`domain_order_id`);

--
-- Indexes for table `server_orders`
--
ALTER TABLE `server_orders`
  ADD PRIMARY KEY (`order_id`),
  ADD KEY `customer_id` (`customer_id`),
  ADD KEY `server_plan_id` (`server_plan_id`);

--
-- Indexes for table `server_plans`
--
ALTER TABLE `server_plans`
  ADD PRIMARY KEY (`plan_id`);

--
-- Indexes for table `support_tickets`
--
ALTER TABLE `support_tickets`
  ADD PRIMARY KEY (`ticket_id`);

--
-- AUTO_INCREMENT for table `billings`
--
ALTER TABLE `billings`
  MODIFY `billing_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `domain_extensions`
--
ALTER TABLE `domain_extensions`
  MODIFY `extension_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `domain_orders`
--
ALTER TABLE `domain_orders`
  MODIFY `order_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;

--
-- AUTO_INCREMENT for table `nameservers`
--
ALTER TABLE `nameservers`
  MODIFY `nameserver_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `server_orders`
--
ALTER TABLE `server_orders`
  MODIFY `order_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT for table `server_plans`
--
ALTER TABLE `server_plans`
  MODIFY `plan_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `support_tickets`
--
ALTER TABLE `support_tickets`
  MODIFY `ticket_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `domain_orders`
--
ALTER TABLE `domain_orders`
  ADD CONSTRAINT `domain_orders_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`customer_id`);

--
-- Constraints for table `nameservers`
--
ALTER TABLE `nameservers`
  ADD CONSTRAINT `fk_domain_order_id_new` FOREIGN KEY (`domain_order_id`) REFERENCES `server_orders` (`order_id`) ON DELETE CASCADE;

--
-- Constraints for table `server_orders`
--
ALTER TABLE `server_orders`
  ADD CONSTRAINT `server_orders_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`customer_id`),
  ADD CONSTRAINT `server_orders_ibfk_2` FOREIGN KEY (`server_plan_id`) REFERENCES `server_plans` (`plan_id`);
COMMIT;

