ALTER TABLE general_system_settings ADD COLUMN `turnitinExpirationDate` datetime DEFAULT NULL;
ALTER TABLE general_system_settings ADD COLUMN `turnitinExpirationContent` longtext;

UPDATE general_system_settings SET turnitinExpirationContent = "The turnitin integration has some prerequisites. User, account, class, assignment etc need to be set up in turnitins web interface and specified in SciPros system settings in order for our integration to have something to work with. Most of the setup is already done, what needs to be redone every once in a while is the class and/or assignment being used needs to be renewed when it runs out. Currently we have a class and assignment that runs from 1 Jan 2013 to 31 Dec 2013. When these run out, new ones must be created.\n\nCreate a class\n\nThis needs to be done every time the class we use for the integration runs out. We generally create classes with duration spanning one semester or 6 months. Make sure to create events in the DSV IT google calendar that have a lot of reminders about this well ahead, so that we dont forget to change the details and update everything before the class we use for our integration runs out.\n\nLog in to turnitin.com using the turnitin username and turnitin password specified in the SciPro system settings. Once logged in, switch to the instructor view. Find the turnitinaccount with the same no as the one specified in the SciPro system settings. Add a class to it with the appropriate duration. Enter the class name and id into SciPros system settings. Now go on to create an assignment.\n\nCreate an assignment\n\nThis needs to be done every time we create a new class for the integration and/or every time the assignment we use for the integration runs out. Make sure to create events in the DSV IT google calendar that have a lot of reminders about this well ahead, so that we dont forget to change the details and update everything before the integration stops working.\n\nLog in to turnitin.com using the turnitin username and turnitin password specified in the SciPro system settings. Once logged in, switch to the instructor view. Find the turnitinaccount with the same no as the one specified in the SciPro system settings. Press the class we use for the integration. Add an assignment with the appropriate duration. Enter the assignment name into SciPros Admin | Settings GUI.";

CREATE TABLE `general_system_settings_turnitin_expiration_recipients` (
  `GeneralSystemSettings_id` bigint(20) NOT NULL,
  `mail` varchar(255) DEFAULT NULL,
  KEY `FKE90D6D9B2AC37675` (`GeneralSystemSettings_id`),
  CONSTRAINT `FKE90D6D9B2AC37675` FOREIGN KEY (`GeneralSystemSettings_id`) REFERENCES `general_system_settings` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO general_system_settings_turnitin_expiration_recipients (GeneralSystemSettings_id, mail) VALUES
    ((SELECT id FROM general_system_settings LIMIT 1), "janne@dsv.su.se"),
    ((SELECT id FROM general_system_settings LIMIT 1), "thesissupport@dsv.su.se");

CREATE TABLE IF NOT EXISTS `general_system_settings_alarm_recipients` (
  `GeneralSystemSettings_id` bigint(20) NOT NULL,
  `mail` varchar(255) DEFAULT NULL,
  KEY `FK3C9272B2AC37675` (`GeneralSystemSettings_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


INSERT INTO `general_system_settings_alarm_recipients` (`GeneralSystemSettings_id`, `mail`) VALUES
(1, 'matchsupport@dsv.su.se');


ALTER TABLE `general_system_settings_alarm_recipients`
  ADD CONSTRAINT `FK3C9272B2AC37675` FOREIGN KEY (`GeneralSystemSettings_id`) REFERENCES `general_system_settings` (`id`);

 CREATE TABLE IF NOT EXISTS `MailEvent_nonUserRecipients` (
  `MailEvent_id` bigint(20) NOT NULL,
  `nonUserRecipients` varchar(255) DEFAULT NULL,
  KEY `FKD7F8996D0814DF5` (`MailEvent_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

ALTER TABLE `MailEvent_nonUserRecipients`
  ADD CONSTRAINT `FKD7F8996D0814DF5` FOREIGN KEY (`MailEvent_id`) REFERENCES `mail_event` (`id`);