scipro/resources/db_update_scripts/update_db-2011-10-25.sql
Jona Ekenberg 2fcd079183 hej
2013-01-18 19:55:18 +01:00

56 lines
2.1 KiB
SQL
Executable File

DROP TABLE question_question_option;
DROP TABLE question_option;
DROP TABLE review_template_question;
DROP TABLE review_template;
CREATE TABLE IF NOT EXISTS `log` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`dateCreated` datetime NOT NULL,
`lastModified` datetime NOT NULL,
`deleted` bit(1) NOT NULL,
`project_id` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `project_id` (`project_id`),
KEY `deleted_index` (`deleted`),
KEY `project_index` (`project_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
ALTER TABLE `log`
ADD CONSTRAINT `project_index` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`);
CREATE TABLE IF NOT EXISTS `log_entry` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`dateCreated` datetime NOT NULL,
`lastModified` datetime NOT NULL,
`deleted` bit(1) NOT NULL,
`contents` longtext,
`creator_id` bigint(20) NOT NULL,
`log_id` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
KEY `deleted_index` (`deleted`),
KEY `creator_index` (`creator_id`),
KEY `log_index` (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
ALTER TABLE `log_entry`
ADD CONSTRAINT `log_index` FOREIGN KEY (`log_id`) REFERENCES `log` (`id`),
ADD CONSTRAINT `creator_index` FOREIGN KEY (`creator_id`) REFERENCES `user` (`id`);
ALTER TABLE general_system_settings ADD COLUMN peerDownloadEnabled bit(1) NOT NULL;
ALTER TABLE project ADD COLUMN stateOfMindDate datetime;
ALTER TABLE peer_request DROP COLUMN reviewTemplate_id;
ALTER TABLE peer_request ADD COLUMN checkListTemplate_id bigint(20);
CREATE INDEX checkListTemplate_index ON peer_request(checkListTemplate_id);
ALTER TABLE answer DROP COLUMN chosenNotApplicable;
ALTER TABLE answer DROP COLUMN radioChoice_id;
ALTER TABLE answer ADD COLUMN answer varchar(255) NOT NULL;
ALTER TABLE question DROP COLUMN freeTextHeading;
ALTER TABLE question DROP COLUMN freeTextQuestion;
ALTER TABLE question DROP COLUMN notApplicableHeading;
ALTER TABLE question DROP COLUMN notApplicableOption;
ALTER TABLE question DROP COLUMN radioChoiceQuestion;
ALTER TABLE question DROP COLUMN reviewTemplate_id;