-- Migracja: products_data.product_url
-- Opis: Idempotentna migracja (bez bledu przy ponownym uruchomieniu)

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