-- Generalizes the decision-letter-only "also send a copy to the student
-- file, with the student number prepended to the subject" behavior into a
-- per-template checkbox any notification can use, replacing the one-off
-- $subject_overrides special case in web/administration.php's
-- decision_letter handling. student_file_email is dropped from the plain
-- `recipient` set since this checkbox now owns that destination exclusively.
--
-- Apply to every environment's database before deploying this change.

ALTER TABLE `notification`
  ADD COLUMN `student_file_copy` tinyint(1) NOT NULL DEFAULT 0 AFTER `recipient`;

UPDATE `notification` SET `student_file_copy` = 1, `recipient` = '["student"]' WHERE `name` = 'decision_letter_template';
