-- Ürün kategorileri: vitrin görseli (image) + ikon (icon); EN için *_en (i18n unified ile uyumlu).
USE faunamix;

SET @c := (SELECT COUNT(*) FROM information_schema.COLUMNS
  WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'product_categories' AND COLUMN_NAME = 'image');
SET @sql := IF(@c = 0,
  'ALTER TABLE product_categories ADD COLUMN image VARCHAR(512) NOT NULL DEFAULT '''' AFTER slug',
  'SELECT 1');
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;

SET @c := (SELECT COUNT(*) FROM information_schema.COLUMNS
  WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'product_categories' AND COLUMN_NAME = 'icon');
SET @sql := IF(@c = 0,
  'ALTER TABLE product_categories ADD COLUMN icon VARCHAR(512) NOT NULL DEFAULT '''' AFTER image',
  'SELECT 1');
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;

SET @c := (SELECT COUNT(*) FROM information_schema.COLUMNS
  WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'product_categories' AND COLUMN_NAME = 'image_en');
SET @sql := IF(@c = 0,
  'ALTER TABLE product_categories ADD COLUMN image_en VARCHAR(512) NULL DEFAULT NULL AFTER image',
  'SELECT 1');
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;

SET @c := (SELECT COUNT(*) FROM information_schema.COLUMNS
  WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'product_categories' AND COLUMN_NAME = 'icon_en');
SET @sql := IF(@c = 0,
  'ALTER TABLE product_categories ADD COLUMN icon_en VARCHAR(512) NULL DEFAULT NULL AFTER icon',
  'SELECT 1');
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
