-- Align products table with save_product.php logic

-- 1. Add sku column
ALTER TABLE `products` ADD COLUMN IF NOT EXISTS `sku` VARCHAR(255) NULL AFTER `nombre`;

-- 2. Rename cost to costo
ALTER TABLE `products` CHANGE COLUMN `cost` `costo` DECIMAL(10, 2) DEFAULT 0.00;

-- 3. Rename price to precio_venta
ALTER TABLE `products` CHANGE COLUMN `price` `precio_venta` DECIMAL(10, 2) DEFAULT 0.00;

-- 4. Add unidades_vendidas column
ALTER TABLE `products` ADD COLUMN IF NOT EXISTS `unidades_vendidas` INT DEFAULT 0 AFTER `precio_venta`;
