-- Migration: Add original cost price column to supplier_return_items
-- This allows tracking both the original purchase cost and the return price

ALTER TABLE `supplier_return_items`
ADD COLUMN `supplier_return_item_original_cost` DECIMAL(12,2) NOT NULL DEFAULT 0 
AFTER `supplier_return_item_quantity`;

-- Rename existing column for clarity
ALTER TABLE `supplier_return_items`
CHANGE COLUMN `supplier_return_item_cost_price` `supplier_return_item_return_price` DECIMAL(12,2) NOT NULL;

-- Update existing records to copy return_price to original_cost (since they were the same)
UPDATE `supplier_return_items` 
SET `supplier_return_item_original_cost` = `supplier_return_item_return_price`;
