-- Add discount_cents to payment_history
ALTER TABLE `payment_history`
  ADD COLUMN `discount_cents` INT NOT NULL DEFAULT 0 AFTER `invoice_pdf`;

-- Add payment_history_id and discount_amount to promo_code_usages
ALTER TABLE `promo_code_usages`
  ADD COLUMN `payment_history_id` INT NULL DEFAULT NULL AFTER `user_id`,
  ADD COLUMN `discount_amount` DECIMAL(10,2) NOT NULL DEFAULT 0.00 AFTER `payment_history_id`,
  ADD CONSTRAINT `fk_pcu_payment` FOREIGN KEY (`payment_history_id`) REFERENCES `payment_history`(`id`) ON DELETE SET NULL;
