prefix}survey` (`course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (0, 0, 0, 985017600, 985017600, 'ciqname', 'ciqintro', '69,70,71,72,73')"); execute_sql("INSERT INTO `{$CFG->prefix}survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (69, 'ciq1', 'ciq1short', '', '', 0, '')"); execute_sql("INSERT INTO `{$CFG->prefix}survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (70, 'ciq2', 'ciq2short', '', '', 0, '')"); execute_sql("INSERT INTO `{$CFG->prefix}survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (71, 'ciq3', 'ciq3short', '', '', 0, '')"); execute_sql("INSERT INTO `{$CFG->prefix}survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (72, 'ciq4', 'ciq4short', '', '', 0, '')"); execute_sql("INSERT INTO `{$CFG->prefix}survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (73, 'ciq5', 'ciq5short', '', '', 0, '')"); } if ($oldversion < 2004021602) { table_column("survey_answers", "answer1", "answer1", "text", "", "", ""); table_column("survey_answers", "answer2", "answer2", "text", "", "", ""); } if ($oldversion < 2004021900) { modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'add', 'survey', 'name');"); modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'update', 'survey', 'name');"); } if ($oldversion < 2004111200) { execute_sql("ALTER TABLE {$CFG->prefix}survey DROP INDEX course;",false); execute_sql("ALTER TABLE {$CFG->prefix}survey_analysis DROP INDEX survey;",false); execute_sql("ALTER TABLE {$CFG->prefix}survey_analysis DROP INDEX userid;",false); execute_sql("ALTER TABLE {$CFG->prefix}survey_answers DROP INDEX userid;",false); execute_sql("ALTER TABLE {$CFG->prefix}survey_answers DROP INDEX survey;",false); execute_sql("ALTER TABLE {$CFG->prefix}survey_answers DROP INDEX question;",false); modify_database('','ALTER TABLE prefix_survey ADD INDEX course (course);'); modify_database('','ALTER TABLE prefix_survey_analysis ADD INDEX survey (survey);'); modify_database('','ALTER TABLE prefix_survey_analysis ADD INDEX userid (userid);'); modify_database('','ALTER TABLE prefix_survey_answers ADD INDEX userid (userid);'); modify_database('','ALTER TABLE prefix_survey_answers ADD INDEX survey (survey);'); modify_database('','ALTER TABLE prefix_survey_answers ADD INDEX question (question);'); } if ($oldversion < 2006042800) { execute_sql("UPDATE {$CFG->prefix}survey SET questions='' WHERE questions IS NULL"); table_column('survey','questions','questions','varchar','255','','','not null'); execute_sql("UPDATE {$CFG->prefix}survey SET intro='' WHERE intro IS NULL"); table_column('survey','intro','intro','text','','','','not null'); execute_sql("UPDATE {$CFG->prefix}survey_answers SET time='0' WHERE time IS NULL"); table_column('survey_answers','time','time','int','10','unsigned','0','not null'); execute_sql("UPDATE {$CFG->prefix}survey_answers SET answer1='' WHERE answer1 IS NULL"); table_column('survey_answers','answer1','answer1','text','','','','not null'); execute_sql("UPDATE {$CFG->prefix}survey_answers SET answer2='' WHERE answer2 IS NULL"); table_column('survey_answers','answer2','answer2','text','','','','not null'); execute_sql("UPDATE {$CFG->prefix}survey_questions SET intro='' WHERE intro IS NULL"); table_column('survey_questions','intro','intro','varchar','50','','','not null'); } ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions. return true; } ?>