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

START TRANSACTION;



--
-- Database: `expiry_reminders`
--

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

--
-- Table structure for table `items`
--

CREATE TABLE `items` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL COMMENT 'Foreign key to users table',
  `name` varchar(255) NOT NULL COMMENT 'Name of the item (domain, hosting plan, etc.)',
  `type` enum('domain','hosting','general') NOT NULL COMMENT 'Type of item being tracked',
  `expiry_date` date NOT NULL COMMENT 'Date when the item expires',
  `owner_email` varchar(255) NOT NULL COMMENT 'Email address to send reminders to',
  `one_month_reminder_sent` tinyint(1) DEFAULT 0 COMMENT 'Flag to track if one-month reminder was sent',
  `last_daily_reminder_sent_on` date DEFAULT NULL COMMENT 'Date when last daily reminder was sent',
  `created_at` timestamp NULL DEFAULT current_timestamp() COMMENT 'When the record was created'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Table to store items with expiry dates for reminder system';

--
-- Dumping data for table `items`
--

INSERT INTO `items` (`id`, `user_id`, `name`, `type`, `expiry_date`, `owner_email`, `one_month_reminder_sent`, `last_daily_reminder_sent_on`, `created_at`) VALUES
(7, 1, 'MyCompany.com Domain', 'domain', '2025-08-15', 'dastgirpgc317@gmail.com', 0, NULL, '2025-06-08 18:15:30'),
(8, 1, 'Premium Web Hosting', 'hosting', '2025-07-20', 'dastgirpgc317@gmail.com', 0, NULL, '2025-06-08 18:15:30'),
(9, 1, 'SSL Certificate - Wildcard', 'general', '2025-09-10', 'dastgirpgc317@gmail.com', 0, NULL, '2025-06-08 18:15:30'),
(11, 1, 'Software License - Adobe Creative Suite', 'general', '2025-12-31', 'dastgirpgc317@gmail.com', 0, NULL, '2025-06-08 18:15:30'),
(12, 1, 'ClientPortal.net Domain', 'domain', '2025-11-05', 'dastgirpgc317@gmail.com', 0, NULL, '2025-06-08 18:15:30'),
(13, 1, 'Cloud Storage Subscription', 'general', '2025-08-30', 'dastgirpgc317@gmail.com', 0, NULL, '2025-06-08 18:15:30'),
(14, 1, 'VPS Server Hosting', 'hosting', '2025-10-15', 'dastgirpgc317@gmail.com', 0, NULL, '2025-06-08 18:15:30'),
(15, 1, 'ProjectManager.org Domain', 'domain', '2025-07-08', 'dastgirpgc317@gmail.com', 0, NULL, '2025-06-08 18:15:30'),
(16, 1, 'API Service Subscription', 'general', '2025-09-22', 'dastgirpgc317@gmail.com', 0, NULL, '2025-06-08 18:15:30');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `items`
--
ALTER TABLE `items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_user_id` (`user_id`),
  ADD KEY `idx_expiry_date` (`expiry_date`),
  ADD KEY `idx_owner_email` (`owner_email`),
  ADD KEY `idx_type` (`type`);

--
-- AUTO_INCREMENT for dumped tables
--

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `items`
--
ALTER TABLE `items`
  ADD CONSTRAINT `items_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
COMMIT;

