DROP TABLE IF EXISTS `ohrm_ics_calendar_invitation_event`;
CREATE TABLE IF NOT EXISTS `ohrm_ics_calendar_invitation_event` (
      `id` int NOT NULL AUTO_INCREMENT,
      `uid` VARCHAR(255) NOT NULL,
      `sequence` int(4) NOT NULL,
      PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `ohrm_ics_calendar_invitation_processor`;
CREATE TABLE IF NOT EXISTS `ohrm_ics_calendar_invitation_processor` (
      `id` int NOT NULL AUTO_INCREMENT,
      `notification_id` int(6) NOT NULL,
      `processor` VARCHAR(255) NOT NULL,
      `is_enabled` int NOT NULL DEFAULT 1,
      `calendar_method` VARCHAR(100) NOT NULL,
      `status` VARCHAR(100) NOT NULL,
      `opacity` VARCHAR(100) NOT NULL,
      PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `ohrm_ics_calendar_content_template`;

CREATE TABLE IF NOT EXISTS `ohrm_ics_calendar_content_template` (
      `id` int NOT NULL AUTO_INCREMENT,
      `notification_id` int(6) NOT NULL,
      `organizer` VARCHAR(255),
      `recipient` VARCHAR(255),
      `summary_text` VARCHAR(255),
      `description_text` VARCHAR(255),
      PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

ALTER TABLE `ohrm_ics_calendar_invitation_processor`
ADD CONSTRAINT FOREIGN KEY (`notification_id`)
REFERENCES `ohrm_notification`(`id`) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE `ohrm_ics_calendar_content_template`
ADD CONSTRAINT FOREIGN KEY (`notification_id`)
REFERENCES `ohrm_notification`(`id`) ON UPDATE CASCADE ON DELETE CASCADE;

