-- sale_date was still DATE, change to DATETIME like issue_date
ALTER TABLE `receipts` MODIFY COLUMN `sale_date` DATETIME NOT NULL;

-- Fix old receipts where issue_date/sale_date lost time (00:00:00)
-- Use created_at as the best available source of actual time
UPDATE `receipts`
SET `issue_date` = `created_at`
WHERE TIME(`issue_date`) = '00:00:00'
  AND DATE(`issue_date`) = DATE(`created_at`);

UPDATE `receipts`
SET `sale_date` = `created_at`
WHERE TIME(`sale_date`) = '00:00:00'
  AND DATE(`sale_date`) = DATE(`created_at`);
