-- Phase 3b: record which unit each purchase line was entered in, plus the base
-- quantity it converted to. Additive/nullable — legacy rows (where quantity was
-- already stored in base units) default to factor 1.

ALTER TABLE `purchase_items` ADD COLUMN `unit_id` BIGINT NULL DEFAULT NULL;
ALTER TABLE `purchase_items` ADD COLUMN `unit_name` VARCHAR(255) NULL DEFAULT NULL;
ALTER TABLE `purchase_items` ADD COLUMN `conversion_factor` DECIMAL(12,3) NULL DEFAULT 1.000;
ALTER TABLE `purchase_items` ADD COLUMN `base_qty` INT NULL DEFAULT NULL;
