-- Add customer_id column to sales table
ALTER TABLE `sales` 
ADD COLUMN `customer_id` int(11) DEFAULT NULL AFTER `user_id`,
ADD CONSTRAINT `sales_customer_fk` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`customer_id`) ON DELETE SET NULL; 