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

START TRANSACTION;



--
-- Database: `diginspire_ecomapp`
--

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

--
-- Table structure for table `banners`
--

CREATE TABLE `banners` (
  `id` int NOT NULL,
  `banner_url` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `banners`
--

INSERT INTO `banners` (`id`, `banner_url`) VALUES
(1, 'https://works.diginspire.in/ecomapp/admin/uploads/banner_1755669906.jpg');

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

--
-- Table structure for table `cart`
--

CREATE TABLE `cart` (
  `cart_id` int NOT NULL,
  `user_id` int NOT NULL,
  `product_id` int NOT NULL,
  `quantity` int NOT NULL DEFAULT '1',
  `size` varchar(50) DEFAULT NULL,
  `color` varchar(50) DEFAULT NULL,
  `added_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `cart`
--

INSERT INTO `cart` (`cart_id`, `user_id`, `product_id`, `quantity`, `size`, `color`, `added_at`) VALUES
(9, 6, 1, 1, 'S', 'Black', '2025-08-18 13:08:23'),
(10, 6, 2, 3, '', '', '2025-08-18 13:08:35'),
(12, 7, 3, 2, 'M', 'Blue', '2025-08-19 11:29:31'),
(18, 1, 6, 1, '', 'Red', '2025-08-20 10:07:08'),
(19, 1, 3, 1, 'M', 'Green', '2025-08-20 10:07:15'),
(20, 8, 1, 1, '', '', '2026-02-20 14:19:54');

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

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

CREATE TABLE `categories` (
  `category_id` int NOT NULL,
  `category_name` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

INSERT INTO `categories` (`category_id`, `category_name`) VALUES
(4, 'Accessories'),
(3, 'Electrics'),
(7, 'Fashion'),
(6, 'Laptops'),
(1, 'shirt'),
(2, 'Smartphone '),
(5, 'Watchs');

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

--
-- Table structure for table `colors`
--

CREATE TABLE `colors` (
  `color_id` int NOT NULL,
  `color_name` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `colors`
--

INSERT INTO `colors` (`color_id`, `color_name`) VALUES
(1, 'Red'),
(2, 'Blue'),
(3, 'Green'),
(4, 'Yellow'),
(5, 'Black'),
(6, 'White'),
(9, 'Golden'),
(10, 'Titanium Black');

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

--
-- Table structure for table `messages`
--

CREATE TABLE `messages` (
  `id` int NOT NULL,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `subject` varchar(255) NOT NULL,
  `message` text NOT NULL,
  `submission_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `messages`
--

INSERT INTO `messages` (`id`, `name`, `email`, `subject`, `message`, `submission_date`) VALUES
(1, 'index.php', 'admin@gmail.com', 'Query', 'Testing', '2025-08-19 12:38:32');

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

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

CREATE TABLE `orders` (
  `order_id` int NOT NULL,
  `user_id` int NOT NULL,
  `order_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `total_amount` decimal(10,2) NOT NULL,
  `shipping_address` json NOT NULL COMMENT 'Stores the full shipping address as a JSON object',
  `payment_details` json DEFAULT NULL COMMENT 'Stores non-sensitive payment info like card last four',
  `status` varchar(50) NOT NULL DEFAULT 'Pending' COMMENT 'e.g., Pending, Processing, Shipped, Delivered, Canceled',
  `payment_status` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `transaction_id` varchar(50) NOT NULL,
  `tracking_id` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Master table for customer orders, containing one row per order.';

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

INSERT INTO `orders` (`order_id`, `user_id`, `order_date`, `total_amount`, `shipping_address`, `payment_details`, `status`, `payment_status`, `created_at`, `transaction_id`, `tracking_id`) VALUES
(1, 1, '2025-08-20 10:01:14', 2.00, '{\"zip\": \"400001\", \"city\": \"Mumbai\", \"phone\": \"9876543210\", \"state\": \"Maharashtra\", \"address1\": \"123 MG Road\", \"address2\": \"Apt 4B1\", \"full_name\": \"Rahul Joshi\"}', '{\"card_expiry\": \"\", \"card_last_four\": \"\", \"payment_method\": \"Credit Card\", \"cardholder_name\": \"\"}', 'Pending', 1, '2025-08-20 10:01:14', 'TXN7A2A1FDBE1', 'TRKF5124D874A'),
(2, 1, '2025-08-20 10:07:20', 201.00, '{\"zip\": \"400001\", \"city\": \"Mumbai\", \"phone\": \"9876543210\", \"state\": \"Maharashtra\", \"address1\": \"123 MG Road\", \"address2\": \"Apt 4B1\", \"full_name\": \"Rahul Joshi\"}', '{\"card_expiry\": \"\", \"card_last_four\": \"\", \"payment_method\": \"Credit Card\", \"cardholder_name\": \"\"}', 'Pending', 0, '2025-08-20 10:07:20', 'TXN21ABC474FB', 'TRKCA00CD1557');

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

--
-- Table structure for table `order_items`
--

CREATE TABLE `order_items` (
  `item_id` int NOT NULL,
  `order_id` int NOT NULL,
  `product_id` int DEFAULT NULL,
  `quantity` int NOT NULL,
  `price` decimal(10,2) NOT NULL COMMENT 'The price of the product at the time of purchase'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Details table for orders, containing each product line item.';

--
-- Dumping data for table `order_items`
--

INSERT INTO `order_items` (`item_id`, `order_id`, `product_id`, `quantity`, `price`) VALUES
(1, 1, 6, 1, 2.00),
(2, 2, 6, 1, 2.00),
(3, 2, 3, 1, 199.00);

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

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

CREATE TABLE `products` (
  `product_id` int NOT NULL,
  `product_name` varchar(255) NOT NULL,
  `category_id` int NOT NULL,
  `short_description` varchar(255) NOT NULL,
  `product_description` text NOT NULL,
  `price` decimal(10,2) NOT NULL,
  `discounted_price` decimal(10,2) DEFAULT NULL,
  `color_variations` json DEFAULT NULL,
  `size_variations` json DEFAULT NULL,
  `image_urls` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

INSERT INTO `products` (`product_id`, `product_name`, `category_id`, `short_description`, `product_description`, `price`, `discounted_price`, `color_variations`, `size_variations`, `image_urls`, `created_at`) VALUES
(1, 'black shirt', 1, 'very good', 'dfyugfch', 30.00, 10.00, NULL, NULL, '[\"https://works.diginspire.in/ecomapp/admin/uploads/products/1771593072_69985d70361e4.png\"]', '2026-02-20 13:11:12'),
(2, 'Cartoon ', 1, 'Bast cotan ', 'Hdhsjutdhsud', 220.00, 12.00, '[\"Blue\"]', '[\"L\"]', '[\"https://works.diginspire.in/ecomapp/admin/uploads/products/1771828536_699bf53842f62.jpg\"]', '2026-02-23 06:35:36'),
(3, 'Zara TShirt', 1, 'The iPhone 16 Pro Max is a high-end smartphone with a 6.9-inch Super Retina XDR display, powered by the Apple A18 Pro chip. It features a triple-camera setup, long battery life, and durable titanium design.', 'The iPhone 16 Pro Max is a high-end smartphone with a 6.9-inch Super Retina XDR display, powered by the Apple A18 Pro chip. It features a triple-camera setup, long battery life, and durable titanium design.', 900.00, 799.00, '[\"Green\"]', '[\"XL\"]', '[\"https://works.diginspire.in/ecomapp/admin/uploads/products/1771837532_699c185ce3165.jpg\", \"https://works.diginspire.in/ecomapp/admin/uploads/products/1771837532_699c185ce336f.jpg\", \"https://works.diginspire.in/ecomapp/admin/uploads/products/1771837532_699c185ce9721.jpg\", \"https://works.diginspire.in/ecomapp/admin/uploads/products/1771837533_699c185d6e342.jpg\", \"https://works.diginspire.in/ecomapp/admin/uploads/products/1771837534_699c185e358f8.jpg\", \"https://works.diginspire.in/ecomapp/admin/uploads/products/1771837534_699c185ed1c89.jpg\", \"https://works.diginspire.in/ecomapp/admin/uploads/products/1771837535_699c185f99233.jpg\", \"https://works.diginspire.in/ecomapp/admin/uploads/products/1771837535_699c185fc228f.jpg\", \"https://works.diginspire.in/ecomapp/admin/uploads/products/1771837535_699c185feb26e.jpg\"]', '2026-02-23 09:05:36'),
(4, 'A/S ARMANI EXCHANGE', 5, 'Hampton analog Watch For Men AX2155', 'Hampton analog Watch For Men AX2155', 16500.00, 7500.00, '[\"Blue\"]', '[\"S\"]', '[\"https://works.diginspire.in/ecomapp/admin/uploads/products/1772794141_69aab11d379aa.jpeg\", \"https://works.diginspire.in/ecomapp/admin/uploads/products/1772794141_69aab11d6cb7b.jpeg\", \"https://works.diginspire.in/ecomapp/admin/uploads/products/1772794141_69aab11d8d2d2.jpeg\", \"https://works.diginspire.in/ecomapp/admin/uploads/products/1772794141_69aab11db3018.jpeg\", \"https://works.diginspire.in/ecomapp/admin/uploads/products/1772794141_69aab11ddf736.jpeg\", \"https://works.diginspire.in/ecomapp/admin/uploads/products/1772794142_69aab11e23b7a.jpeg\", \"https://works.diginspire.in/ecomapp/admin/uploads/products/1772794142_69aab11e50e4c.jpeg\"]', '2026-03-06 10:49:02');

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

--
-- Table structure for table `reviews`
--

CREATE TABLE `reviews` (
  `review_id` int NOT NULL,
  `product_id` int NOT NULL,
  `reviewer_name` varchar(255) NOT NULL,
  `rating` int NOT NULL,
  `review_text` text NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `reviews`
--

INSERT INTO `reviews` (`review_id`, `product_id`, `reviewer_name`, `rating`, `review_text`, `created_at`) VALUES
(1, 1, 'Vaibhav', 5, 'Excellent quality! The fabric feels very soft and comfortable.', '2025-08-17 16:55:35'),
(3, 1, 'Sonam', 5, 'Loved it! Perfect fit and color as expected.', '2025-08-17 16:55:35'),
(4, 1, 'sdfsdf', 4, 'sdfsdf', '2025-08-17 16:58:11'),
(8, 2, 'Testing', 3, 'Good', '2025-08-18 10:11:03');

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

--
-- Table structure for table `sizes`
--

CREATE TABLE `sizes` (
  `size_id` int NOT NULL,
  `size_name` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `sizes`
--

INSERT INTO `sizes` (`size_id`, `size_name`) VALUES
(1, 'XS'),
(2, 'S'),
(3, 'M'),
(4, 'L'),
(5, 'XL');

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

--
-- Table structure for table `website_settings`
--

CREATE TABLE `website_settings` (
  `id` int NOT NULL,
  `website_name` varchar(255) NOT NULL,
  `logo_url` varchar(255) NOT NULL,
  `contact_email` varchar(255) NOT NULL,
  `website_address` varchar(255) NOT NULL,
  `website_phone` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `website_settings`
--

INSERT INTO `website_settings` (`id`, `website_name`, `logo_url`, `contact_email`, `website_address`, `website_phone`) VALUES
(1, 'Lulu369', 'https://works.diginspire.in/ecomapp/admin/uploads/logo/logo-1771679812.png', 'contact@lulu369.org', 'Delhi ', '+91 81681 39628');

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

--
-- Table structure for table `wishlist`
--

CREATE TABLE `wishlist` (
  `wishlist_id` int NOT NULL,
  `user_id` int NOT NULL,
  `product_id` int NOT NULL,
  `added_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `wishlist`
--

INSERT INTO `wishlist` (`wishlist_id`, `user_id`, `product_id`, `added_at`) VALUES
(1, 1, 2, '2025-08-18 08:31:56'),
(3, 1, 1, '2025-08-18 10:20:45');

--
-- Indexes for dumped tables
--

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

--
-- Indexes for table `cart`
--
ALTER TABLE `cart`
  ADD PRIMARY KEY (`cart_id`),
  ADD KEY `user_id` (`user_id`),
  ADD KEY `product_id` (`product_id`);

--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
  ADD PRIMARY KEY (`category_id`),
  ADD UNIQUE KEY `category_name` (`category_name`);

--
-- Indexes for table `colors`
--
ALTER TABLE `colors`
  ADD PRIMARY KEY (`color_id`);

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

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

--
-- Indexes for table `order_items`
--
ALTER TABLE `order_items`
  ADD PRIMARY KEY (`item_id`),
  ADD KEY `order_id` (`order_id`),
  ADD KEY `product_id` (`product_id`);

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

--
-- Indexes for table `reviews`
--
ALTER TABLE `reviews`
  ADD PRIMARY KEY (`review_id`),
  ADD KEY `product_id` (`product_id`);

--
-- Indexes for table `sizes`
--
ALTER TABLE `sizes`
  ADD PRIMARY KEY (`size_id`);

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

--
-- Indexes for table `wishlist`
--
ALTER TABLE `wishlist`
  ADD PRIMARY KEY (`wishlist_id`),
  ADD UNIQUE KEY `user_product` (`user_id`,`product_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `banners`
--
ALTER TABLE `banners`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `cart`
--
ALTER TABLE `cart`
  MODIFY `cart_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;

--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
  MODIFY `category_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `colors`
--
ALTER TABLE `colors`
  MODIFY `color_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `messages`
--
ALTER TABLE `messages`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `orders`
--
ALTER TABLE `orders`
  MODIFY `order_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `order_items`
--
ALTER TABLE `order_items`
  MODIFY `item_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `products`
--
ALTER TABLE `products`
  MODIFY `product_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `reviews`
--
ALTER TABLE `reviews`
  MODIFY `review_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `sizes`
--
ALTER TABLE `sizes`
  MODIFY `size_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `website_settings`
--
ALTER TABLE `website_settings`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `wishlist`
--
ALTER TABLE `wishlist`
  MODIFY `wishlist_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `order_items`
--
ALTER TABLE `order_items`
  ADD CONSTRAINT `order_items_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `orders` (`order_id`) ON DELETE CASCADE,
  ADD CONSTRAINT `order_items_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`product_id`) ON DELETE SET NULL;

--
-- Constraints for table `reviews`
--
ALTER TABLE `reviews`
  ADD CONSTRAINT `reviews_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `products` (`product_id`);
COMMIT;

