-- ============================================
-- ADD CDN FIELDS TO ALL TABLES
-- Run this SQL in phpMyAdmin
-- ============================================

-- SLIDERS TABLE
ALTER TABLE `sliders` 
ADD COLUMN `slider_image_cdn_url` VARCHAR(500) DEFAULT '' COMMENT 'CDN image URL',
ADD COLUMN `slider_use_cdn` TINYINT(1) DEFAULT 0 COMMENT 'Use CDN (1=yes, 0=no)';

-- STORES TABLE
ALTER TABLE `stores` 
ADD COLUMN `store_image_cdn_url` VARCHAR(500) DEFAULT '' COMMENT 'CDN image URL',
ADD COLUMN `store_use_cdn` TINYINT(1) DEFAULT 0 COMMENT 'Use CDN (1=yes, 0=no)';

-- COUPONS TABLE
ALTER TABLE `coupons` 
ADD COLUMN `coupon_image_cdn_url` VARCHAR(500) DEFAULT '' COMMENT 'CDN image URL',
ADD COLUMN `coupon_use_cdn` TINYINT(1) DEFAULT 0 COMMENT 'Use CDN (1=yes, 0=no)';

-- CAMPAIGNS TABLE
ALTER TABLE `campaigns` 
ADD COLUMN `campaign_image_cdn_url` VARCHAR(500) DEFAULT '' COMMENT 'CDN image URL',
ADD COLUMN `campaign_use_cdn` TINYINT(1) DEFAULT 0 COMMENT 'Use CDN (1=yes, 0=no)';

-- POPUPS TABLE
ALTER TABLE `popups` 
ADD COLUMN `popup_image_cdn_url` VARCHAR(500) DEFAULT '' COMMENT 'CDN image URL',
ADD COLUMN `popup_use_cdn` TINYINT(1) DEFAULT 0 COMMENT 'Use CDN (1=yes, 0=no)';

-- CATEGORIES TABLE
ALTER TABLE `categories` 
ADD COLUMN `category_image_cdn_url` VARCHAR(500) DEFAULT '' COMMENT 'CDN image URL',
ADD COLUMN `category_use_cdn` TINYINT(1) DEFAULT 0 COMMENT 'Use CDN (1=yes, 0=no)';

-- ============================================
-- VERIFICATION - Check if fields were added
-- ============================================

SELECT 'Checking sliders table...' as status;
SHOW COLUMNS FROM sliders LIKE '%cdn%';

SELECT 'Checking stores table...' as status;
SHOW COLUMNS FROM stores LIKE '%cdn%';

SELECT 'Checking coupons table...' as status;
SHOW COLUMNS FROM coupons LIKE '%cdn%';

SELECT 'Checking campaigns table...' as status;
SHOW COLUMNS FROM campaigns LIKE '%cdn%';

SELECT 'Checking popups table...' as status;
SHOW COLUMNS FROM popups LIKE '%cdn%';

SELECT 'Checking categories table...' as status;
SHOW COLUMNS FROM categories LIKE '%cdn%';

SELECT 'All CDN fields added successfully!' as final_status;
