-- home_hero_slides.locale + EN kopyaları
USE faunamix;

SET @col = (
  SELECT COUNT(*) FROM information_schema.COLUMNS
  WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'home_hero_slides' AND COLUMN_NAME = 'locale'
);
SET @sql = IF(
  @col = 0,
  "ALTER TABLE home_hero_slides ADD COLUMN locale VARCHAR(16) NOT NULL DEFAULT '' AFTER id",
  'SELECT 1'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

INSERT INTO home_hero_slides (locale, sort_order, image_path, baslik_1, baslik_2, baslik_3, baslik_4, alt_text)
SELECT 'en', h.sort_order, h.image_path, h.baslik_1, h.baslik_2, h.baslik_3, h.baslik_4, h.alt_text
FROM home_hero_slides h
WHERE h.locale = ''
  AND NOT EXISTS (SELECT 1 FROM home_hero_slides e WHERE e.locale = 'en' AND e.sort_order = h.sort_order);
