-- DentalCare 0.5.9.8.25: guided treatment completion, discharge, and billing handoff.
ALTER TABLE `{{prefix}}clinical_encounters`
  ADD COLUMN IF NOT EXISTS `completion_destination` VARCHAR(40) NULL AFTER `finalized_hash`,
  ADD COLUMN IF NOT EXISTS `no_payment_reason` VARCHAR(500) NULL AFTER `completion_destination`,
  ADD COLUMN IF NOT EXISTS `discharge_summary_json` LONGTEXT NULL AFTER `no_payment_reason`,
  ADD COLUMN IF NOT EXISTS `billing_handoff_amount` DECIMAL(12,2) NOT NULL DEFAULT 0.00 AFTER `discharge_summary_json`,
  ADD COLUMN IF NOT EXISTS `billing_handoff_at` DATETIME NULL AFTER `billing_handoff_amount`,
  ADD COLUMN IF NOT EXISTS `discharged_at` DATETIME NULL AFTER `billing_handoff_at`,
  ADD COLUMN IF NOT EXISTS `chair_released_at` DATETIME NULL AFTER `discharged_at`;
