1# task_id can be NULL because tko_jobs.afe_job_id, which it replaces, can be 2# NULL. Same for parent_task_id. 3UP_SQL = """ 4CREATE TABLE tko_task_references ( 5 id integer AUTO_INCREMENT NOT NULL PRIMARY KEY, 6 reference_type enum('skylab', 'afe') NOT NULL, 7 tko_job_idx int(10) unsigned NOT NULL, 8 task_id varchar(20) DEFAULT NULL, 9 parent_task_id varchar(20) DEFAULT NULL, 10 CONSTRAINT tko_task_references_ibfk_1 FOREIGN KEY (tko_job_idx) REFERENCES tko_jobs (job_idx) ON DELETE CASCADE, 11 KEY reference_type_id (reference_type, id) 12) ENGINE=InnoDB; 13""" 14 15DOWN_SQL = """ 16DROP TABLE IF EXISTS tko_task_references; 17""" 18