-- Migracja: dodanie kolumny custom_label_1 do tabeli products
-- Cel: wsparcie edytowalnej kolumny CL1 w widoku /products (analogicznie do custom_label_4)

SET @sql = IF(
  EXISTS (
    SELECT 1
    FROM INFORMATION_SCHEMA.COLUMNS
    WHERE TABLE_SCHEMA = DATABASE()
      AND TABLE_NAME = 'products'
      AND COLUMN_NAME = 'custom_label_1'
  ),
  'DO 1',
  'ALTER TABLE `products` ADD COLUMN `custom_label_1` VARCHAR(255) NULL DEFAULT NULL AFTER `min_roas`'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
