--------------------------------------------------
-- Master issue reference
-- Created 201100303
--------------------------------------------------

ALTER TABLE `cehior_auth_header`
  ADD `master` INT( 10 ) NULL AFTER `serial_no` ;

ALTER TABLE `cehior_auth_header`
  ADD INDEX ( `master` ) ;

CREATE TABLE IF NOT EXISTS `issue_link` (
  `issue_event_id` bigint(20) NOT NULL,
  `linked` tinyint(1) NOT NULL,
  `linked_issue` int(10) NOT NULL,
  `role` char(1) NOT NULL,
  `matching_event_id` bigint(20) NOT NULL,
  PRIMARY KEY  (`issue_event_id`),
  CONSTRAINT `fkil1` FOREIGN KEY (`issue_event_id`) REFERENCES `issue_event` (`id`),
  CONSTRAINT `fkil2` FOREIGN KEY (`matching_event_id`) REFERENCES `issue_event` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
