-- =============================================================
-- Full DB Update Script
-- Uses images from New folder for products and categories
-- =============================================================

-- 1. Update missing category images using the new images
UPDATE categories SET image = 'shirts.png'      WHERE id = 1 AND image != 'shirts.png';
UPDATE categories SET image = 'tshirts.png'     WHERE id = 2 AND image != 'tshirts.png';
UPDATE categories SET image = 'underwear.png'   WHERE id = 3;
UPDATE categories SET image = 'underskirts.png'  WHERE id = 4;
UPDATE categories SET image = 'mattress.png'    WHERE id = 5;

-- 2. Update existing products (IDs 1-5) with missing images
UPDATE products SET image = 'shirts.png'      WHERE id = 1;
UPDATE products SET image = 'tshirts.png'     WHERE id = 2;
UPDATE products SET image = 'underwear.png'   WHERE id = 3;
UPDATE products SET image = 'underskirts.png'  WHERE id = 4;
UPDATE products SET image = 'mattress.png'    WHERE id = 5;

-- 3. Fix category assignments for newly inserted products (IDs 6-10)
UPDATE products SET category_id = 1 WHERE id = 6;  -- Women's Shirt -> Shirts
UPDATE products SET category_id = 2 WHERE id = 7;  -- Women's T-Shirt -> T-Shirts
UPDATE products SET category_id = 4 WHERE id = 8;  -- Women's Underskirt -> Underskirts
UPDATE products SET category_id = 3 WHERE id = 9;  -- Women's Underwear -> Underwear
UPDATE products SET category_id = 5 WHERE id = 10; -- Mattress -> Mattress Covers

-- 4. Rename new images to prod_ format for IDs 1-5 (optional: keeps both naming styles)
-- Products 6-10 keep their current names (shirts.png, etc.)
-- Products 1-5 now also point to the same images

SELECT 'Update complete!' AS status;
