-- Ürün detay: opsiyonel YouTube video URL (açıklama paneli yanında embed).
SET @col_exists := (
  SELECT COUNT(*) FROM information_schema.COLUMNS
  WHERE TABLE_SCHEMA = DATABASE()
    AND TABLE_NAME = 'products'
    AND COLUMN_NAME = 'video_url'
);

SET @ddl := IF(
  @col_exists = 0,
  'ALTER TABLE products ADD COLUMN video_url VARCHAR(512) NULL DEFAULT NULL AFTER content_html',
  'SELECT 1'
);

PREPARE stmt FROM @ddl;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

-- Demo vitrin (yalnızca boşsa): Premiks mineral dengesi
UPDATE products
SET video_url = 'https://www.youtube.com/watch?v=ysz5S6PUM-U'
WHERE slug = 'premiks-mineral-dengesi'
  AND (video_url IS NULL OR TRIM(video_url) = '');
