-- Liste vitrininde gösterilecek kapak görselleri (virgülle ayrılmış; images alt kümesi).
-- Idempotent.

SET @col_exists := (
  SELECT COUNT(*) FROM information_schema.COLUMNS
  WHERE TABLE_SCHEMA = DATABASE()
    AND TABLE_NAME = 'products'
    AND COLUMN_NAME = 'cover_images'
);

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

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