-- migration of old ideas without languages and research areas makes this necessary
ALTER TABLE  `newidea` CHANGE  `language_id`  `language_id` BIGINT( 20 ) NULL DEFAULT NULL;
ALTER TABLE  `newidea` CHANGE  `researchArea_id`  `researchArea_id` BIGINT( 20 ) NULL DEFAULT NULL;

CREATE TABLE `newidea_export` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `dateCreated` datetime NOT NULL,
  `lastModified` datetime NOT NULL,
  `version` int(11) NOT NULL,
  `reason` varchar(255) DEFAULT NULL,
  `result` varchar(255) DEFAULT NULL,
  `idea_id` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `FK68FA705CFCDADF61` (`idea_id`),
  CONSTRAINT `FK68FA705CFCDADF61` FOREIGN KEY (`idea_id`) REFERENCES `newidea` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- New system setting that controls if participations needs to be confirmed on new ideas.
ALTER TABLE `general_system_settings` ADD `matchPartnerConfirmation` bit(1) NOT NULL;

CREATE TABLE `settings_date` (
  `style` varchar(255) NOT NULL,
  `dateCreated` datetime NOT NULL,
  `lastModified` datetime NOT NULL,
  `version` int(11) NOT NULL,
  `format` varchar(255) NOT NULL,
  PRIMARY KEY (`style`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `settings_date` (`style`, `format`, `dateCreated`, `lastModified`, `version`)
VALUES
  ("DATE", "yyyy-MM-dd", NOW(), NOW(), 0),
  ("DATETIME", "yyyy-MM-dd HH:mm", NOW(), NOW(), 0),
  ("TIME", "HH:mm", NOW(), NOW(), 0);
